WB Tutorial Questions

Discussion in 'General Modification' started by Ranth, Jan 17, 2009.

Remove all ads!
  1. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    Stupid question (because I haven't modded in months).

    If my generic spawner script fires off to change the map, like the following:

    Code:
    	if (attachee.map == 5001 and game.global_flags[1] == 0):	#  Teleport Test
    		game.fade_and_teleport( 0, 0, 0, 5077, 505, 473)
    		attachee.destroy()
    Does that destroy the spawner for the entire saved game, or does it just destroy it for that map-load? I am afraid I may have destroyed the spawner testing the map teleport the first time, because this spawner wont spawn NPC's for the Hommlet invasion anymore. If it destroys it for the entire saved game, then there would be a problem having the game load the new Hommlet map each time the party comes to Hommlet, but it would be a memory lag to make it a heatbeat script not a first_heartbeat.

    Note: That code is in the first heatbeat script.
     
  2. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,000
    Likes Received:
    24
    Well there's no real reason to destroy the spawner, is there? Leave it there and it will do its job (teleport you) every time it's called upon. (I do believe the destroy command would destroy it permanently, btw.)

    Have you considered .mobs with the OCF_OFF flag set instead? Set their first heartbeats to unset OCF_OFF when whatever flag you assign to trigger your mod is set. I'm finding this much preferable to spawning everything; it's the way Troika did it in some cases.
     
  3. Shiningted

    Shiningted I want my goat back Global Moderator

    Joined:
    Oct 23, 2004
    Messages:
    11,789
    Likes Received:
    37
    OF_OFF ;) And yes, when you destroy something, its gone forever: you only use this when the thing has done its job.
     
  4. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    Thanks much.

    I am finding that previously operational portions of my mod no longer work. Before my evil invasion of Hommlet worked perfectly, and now there are errors. Terjon, Calmert, Rufus, and Jaroo sit and do nothing. They wont attack the PCs, or defend themselves if attacked (wont begin to attack back). Burne, the guards, and Smythe will attack. It is the strangest thing. I also have Melany in my party, but I tried removing her and still have the same problem.

    I even coded the party to be Butchers of Hommlet before the fight so that they would be hated via reputation.

    Anyone have ideas or encountered this before? I am thinking that the san_combat scripts must be erroring somehow now, but I have no idea why it would error now and not before.

    Edit: I am having this problem too if I fight the Hextor priests in Verb. They wont attack. I am also starting all combat via dialogue with code similar to this:
    Code:
    {1430}{Attack!}{Attack!}{}{}{}{}
    {1431}{[Attack!]}{}{1}{}{}{npc.attack( pc )}
     
    Last edited: Aug 9, 2009
  5. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,000
    Likes Received:
    24
    You need a zero in there to tell dialog to end properly.

    Code:
    {1430}{Attack!}{Attack!}{}{}{}{}
    {1431}{[Attack!]}{}{1}{}{[B][COLOR="Red"]0[/COLOR][/B]}{npc.attack( pc )}
     
  6. Shiningted

    Shiningted I want my goat back Global Moderator

    Joined:
    Oct 23, 2004
    Messages:
    11,789
    Likes Received:
    37
    Have you broken something like py00002BlackJay.py (which almost every NPC uses as his combat script?)
     
  7. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    Gaear, I tried adding the zero and it did not help.
    Ted, I do not believe the py00002BlackJay.py is at fault because I know Terjon does not use it, he has his own combat scripts (calling Calmert ect).

    I am starting to believe that each of these NPC's has a combat dialogue script that I need to supress somehow so Terjon does not call Calmert, Jaroo does not call for his bears. I remember stopping Terjon from doing this before, but I cant find the files.

    Update: The combat scripts are not the problem (I dont think). Jaroo doesn't have one other than to dual wield and I removed Terjon's and he still froze.

    Update 2: If I go into the church and attack Calmert he is frozen and does not call for Terjon. I must have messed up something somewhere else in game. Grr... Also notice that I need to click the hextor priests that starts the dialogue for the invasion 2 or 3 times before he starts dialogue. I wonder if this is a root problem.

    Update 3: The problem needs to be deep rooted because I reloaded my mod (without anything I did in the last day) and NPCs wont work together. When I attack the Hextor priest (via dialogue or spell), he will fight me but his friends dont join in. They are in the initiative que but wont fight. I need to kill them to end combat.

    Update 4: Reloaded a very old mod package. The main NPCs attack now but the badgers dont.
     
    Last edited: Aug 9, 2009
  8. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,000
    Likes Received:
    24
    Are there tons of enemies in the combat queue? I believe Sitra identified the maximum number of participants as 30. Also, ToEE has long had random problems with random combatants just 'sitting it out' from time to time. It seems strange though that it worked before but doesn't now, but ToEE is famous for that too. More times than I can recall I've had things happen one way one time and another way the next time with absolutely no changes made in between.
     
  9. wizgeorge

    wizgeorge Prophet of Wizardy

    Joined:
    Feb 19, 2005
    Messages:
    1,715
    Likes Received:
    0
    ToEE isn't the only game with random strangeness. The Witcher and Medal of Honor do the same things. One time the german will throw a grenade, the next time he just stands there. In the Witcher the monster will bob and weave and just look up in the sky. the next time it attacks. Go figure.
     
  10. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    How is a DLG called at the end of combat? An example would be at the end of the CE intro when you kill the peasants and at the end of the battle one of them tells you about Hommlet. I could not find PY 199 or 191 in the ToEE files that their prototypes call.

    I have the below code on a sans_dying but it is not working. It may be because this npc is in battle with others. If he dies before the last NPC dies, this dont not fire off (which is how I want it) but it does not fire off after the last NPCs death.

    Code:
    def san_dying(attachee, triggerer ):
    	leader = game.party[0]
    	leader.begin_dialog( attachee, 2200 )
    	return RUN_DEFAULT
     
  11. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    4,654
    Likes Received:
    131
    It is a little hard to talk when you're dead, even if you die last, you could add a global vars to the dying script of all combatants in the fight, and add a call to the san_heartbeat script in your spawner when the vars number matches the number of combatants killed, it can fire the dialogue - that way when they are all dead, a non combatant will start the dialogue you want.
     
  12. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    Thanks much. Also, I have noticed that whenever I kill Rufus in my testing he does not fall down and die. He remains standing in a combat position, but he does stop attacking. Is this a known 5.5.0 issue or something special with my mod?
     
  13. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    Has anyone ever had the problem where a sans_dying script wont count a death if the person is unconscious at the right before I finish combat (even if they die from bleeding out once combat ends)?

    Furthermore, does anything look wrong with this code for my spawner?

    Code:
    def san_dialog( attachee, triggerer ):
    	triggerer.begin_dialog( attachee, 100)
    	return SKIP_DEFAULT
    
    
    def san_heartbeat( attachee, triggerer ):
    	if (attachee.map == 5135 and game.global_vars[502] == 4):	# Check for Hextor Clerics Death
    		leader = game.party[0]	
    		leader.begin_dialog( attachee, 100)	
    		game.global_vars[502] = 5 #Changed variable so it would not keep looping. Did not want to destroy spawner.
    	return SKIP_DEFAULT
    After I kill the four hextor clerics, the spawner runs through the code because it changes the 502 variable to 5 (I checked through control panel, but it does not launch the dialog script. I have the DLG and PY files with the same naming convention, the prototype has the correct dialog #'s, and it wont fire.

    Interestingly, if I got rid of the "game.global_vars[502] = 5" line and change it to a "attachee.destroy()" then I get a chat box to pop up, but my characters name is at the top (where the NPCs name usually is) and two blank dialogue options. I am assuming this is because I destroy the NPC/attachee.
     
  14. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,000
    Likes Received:
    24
    Don't know if this is your issue but could be:

    Code:
    def san_dialog( attachee, triggerer ):
    	triggerer.begin_dialog( attachee, 100 )
    	return SKIP_DEFAULT
    
    
    def san_heartbeat( attachee, triggerer ):
    	if [B][COLOR="Red"]([/COLOR][/B](attachee.map == 5135[B][COLOR="Red"])[/COLOR][/B] and [B][COLOR="red"]([/COLOR][/B]game.global_vars[502] == 4)[B][COLOR="red"])[/COLOR][/B]:	# Check for Hextor Clerics Death
    		leader = game.party[0]	
    		leader.begin_dialog( attachee, 100 )	
    		game.global_vars[502] = 5 #Changed variable so it would not keep looping. Did not want to destroy spawner.
    	return SKIP_DEFAULT
    Scripts seem to be written in a variety of ways, many times seemingly different but still operational or seemingly identical but not operational.

    Also, are you using the generic spawner proto, or have you made your own spawner? If you made your own, be sure its san_heartbeat and san_dialog scripts (and all other appropriate scripts) are set to your spawner's .py file number in protos.tab. This is something I normally forget until the last, after many "Why??!! Why??!!" moments.
     
    Last edited: Aug 10, 2009
  15. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    Thanks Gaear,

    The problem has to be the code:
    Code:
    leader.begin_dialog( attachee, 100 )
    Because the variable does get changed to 5, so the if statement is running correctly. I cant figure out why it wont run though... grr. Would it be because the spawner has OF_OFF active? I tried it both ways but it doesn't seem to matter unless I need to reload the zone in order for the protos.tab to update (right now I am just updating files and loading a save with the last hextorite near death).
     
    Last edited: Aug 10, 2009
Our Host!