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:
    1
    Thanks Ted. Some more questions.

    First: What is the rule for needed to reload the game to see your changes?
    I noticed that I could Alt+Tab, edit a file, save it, and then go in game to see immediate changes to dialogue. Does that not work with scripts?

    Second: Is there a file I should look for that lists all current global flags?

    Third: What does the following code mean?
    Code:
    	if (attachee.map == 5093):
    		game.areas[7] = 1
    		attachee.destroy()
    I dont understand the game.areas variable.

    Forth: The destroy command does not seem to work in following dialogue. Can you see a problem?
    Code:
    {2011}{I will destroy it. [Destroy the golden skull.]}{}{1}{}{2020}{gold_skull = pc.item_find(2203); gold_skull.destroy()}
    Thanks for all of the help Ted. I am trying my best to learn but I still run into all of these problems.
     
    Last edited: Jan 24, 2009
  2. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    1
    Also, what is the difference between heartbeat and first_heartbeat scripts?

    Does firstheartbeat activate on loading/starting a game?
     
  3. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    First heartbeat will activate on loading a map. It does not activate on starting a save for critters on the same map, but can be forced to fire under such situations by deleing the .pyc file that compiles for each .py file.

    Normal heartbeats fire every second or so. The occur faster the closer your PCs get to the critter. If you have no first heartbeat, then heartbeats will occur immediately, otherwise they will start a heartbeat after the first one.

    To see changes to a script is complicated: you might need to start a new game, especially if you don't just alter things but add them. For instance, if a mob in the game has no heartbeat and you add one to its prototype in protos.tab, you will have to start a new game: the mob will already have been created according to its prototype and changes in protos.tab will NOT be taken into account (thats if you haven't already encountered the mob: if your changing, say, Thrommel's prototype, and you haven't been to the temple yet, then his mob won't have been created yet and you can fiddle with the prototype without starting a new game. Generally speaking, the best thing to do is create a new protoype to see what it does (create 14xxx) and remember you will need to change maps to see stuff like a first heartbeat. Also, deleting the .pyc file is NOT necessary in general play but can help if you have saved right next to a critter and load up after a change.

    The game area command:

    http://rpg-rant.blogspot.com/2008/07/maps-areas-and-quests.html

    And the global flags you seem to have found :)
     
  4. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    1
    Thanks Ted,

    Going back to a few posts ago regarding checking to see if Burne is in the tower, and if so destroying him and creating him in Nulb, what is the command to look for NPC's on other maps? I have found this command:

    find_npc_near()
    But that only works with the same map you are on. So if I was in Nulb, how would I check another map? Do I need to have a script physically delete the GUID files (which would remove them from other saves/games).

    Or should I just check if Burne should be gone, and destroy him on map load. I tried using the generic spawner, put the MOB file in the main room of the tower, and have the below code added to the script, but it wont destroy Burne (or anyone else I try). I am sure 502 is flagged because it causes other things to happen.

    Code:
    	if (attachee.map == 5016) and (game.global_flags[502] == 1):
    			Tower(attachee)
    			attachee.destroy()
    
    def Tower(spawner): 
    	for obj in game.obj_list_vicinity(attachee.location):
    		if (obj.name == 8054 and obj.leader_get() == OBJ_HANDLE_NULL): #Burne 
    			obj.destroy()
    I am also running into the following problems regarding spells in combat:
    1) Fighting Burne, he summons a monster and in the middle of the fight the monster (one of those flying stone gargolye things) starts fighting with Rufus and a Badger instead of my group. Is there any easy fix to this?

    2) I set up a fight with Calmert and Terjon and my party (not in the church). During the dialogue, I have them buff themselves with several spells. I notice that if I go too fast through the dialogue, some of their buffs are not being cast. I think it is because I am calling a script to cast a buff, but they are finishing a previous buff spell. Is there a way to make sure they cast all of their buffs? (Note: My script is very similar to the Brigand Leader in the Back Tower in your tutorial).

    3) In the #2 situation, one of Calmert's buff spells is Magic Circle Against Chaos. But when combat starts, Calmert always casts it again as his first spell. He only has it once in his protos spells, is there a way to make sure he doesn't cast it a 2nd time? Also, is there a way to make him and Terjon fight with more offensive spells instead of healing and buffing constantly?
     
    Last edited: Jan 26, 2009
  5. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    1
    I am also confused by how Al appears in Delko Grove. I understand the script that calls him in the generic spawner file, but how does it cue all of his armor and weapons? There are no MOB files for him in the map folders for vanilla or 5.5.0.

    Code:
    def drow_ring(spawner):
    	# drow_ring script by rufnredde add Black Jays Wifes Ring and Drow to Deklo Grove for Evil Parties
    	if ((game.party_alignment == LAWFUL_EVIL or game.party_alignment == CHAOTIC_EVIL or game.party_alignment == NEUTRAL_EVIL) and game.global_flags[410] != 1):
    		leader = game.party[0]
    		Al = game.obj_create(14677, location_from_axis( 467, 451 ))
    		create_item_in_inventory( 6270, Al )
    		create_item_in_inventory( 9999, Al )
    		Al.turn_towards(leader)
    		leader.turn_towards(Al)
    		StopCombat(Al, 0)
    		leader.begin_dialog( Al, 100 )
    		game.global_flags[410] = 1
    	return
    This just spawns jays ring and a note. Where does it cue up all of his armor and weapons? I thought there needed to be MOB files in the folders for him.

    I am noticing that I can spawn Rufus/Burne and any NPC's I have met in my game on any map with their equipment without moving MOB files around. However, when I try to import a new character that I have made in WB with a script like:

    robin = game.obj_create(14821, location_from_axis( 474, 472 ))
    robin.turn_towards(leader)

    They show up naked (even if their equipment MOB files are in the map directory). I am so confused.
     
    Last edited: Jan 27, 2009
  6. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    Spawned creatures and mobbed creatures are two different things: a creature spawned from a script will get its gear from the Invensource.mes file, according to the entry in column... ummm I forget the number ;) but its the column marked inventory in protos.tab. Note that mobs TRUMP this, so while editing Invensource.mes will change what spawned creatures will appear with, anything you mob will remain that way no matter what you do to Invensource.mes. Also note that Invensource.mes is VERY touchy and any errors in that file will mean the game will refuse to load.

    As for using find_npc_near or anything else across maps - can't be done, the game doesn't hold that much stuff in memory (afaik). Thats why we have global flags - for global events.

    Monsters fight against anything not in their faction: check the faction col in protos.tab, and THIS comment from Krunch regarding adding factions to mobs.

    If you don't want Calmert to cast something in combat, remove it from his entry in strategy.tab.
     
    Last edited: Jan 27, 2009
  7. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    Heh.. last answer isn't 'registering'. Thats weird.

    BUMP!
     
    Last edited: Jan 27, 2009
  8. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    1
    Your my hero Ted.
     
  9. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    I should think so :cool:

    Thanks for that PM btw. :) I'll just add that its always best to ask things in the forum, so others can learn (and find when they search).
     
  10. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    1
    Thanks Ted. I noticed there is a logger script, but I cannot figure out how to use it (and I searched for 'logger' and found nothing relevant ;) ) Can you give me a quick rundown of the console commands I need to do?

    Apparently I can no longer start a new game with my mod (though I can load previous games), so I think I will eventually have to take care of that before this ever gets released... that a little bit of a major bug haha. It must be a protos or description problem since the rest of the my edits are just adding dialogue and scripts that would not be read on loadup.
     
  11. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    Logger script? Nope, thats a new one to me :scratchhe
     
  12. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    1
    data/scr/co8util/logger.py

    I assumed it logged variables and the commands that were run in order to debug files easier. Nevermind then.
     
  13. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    1
    Ted,

    Thought on our previous conversation regarding the earthquake, and changing the landscape of an area (artwork and sectoring)... Didn't Trokia do that in ToEE when you find the golden skull and the throne moves and there is now a hole? They changed the artwork, and you cannot walk on top of the hole (changed the sectoring).

    I wonder how they did that. I cant find any artwork tiles without the hole in the ToEE.dat
     
  14. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    The throne hole is an object, not background art + sectoring.

    The logger thing, if it is in Co8util, is probably something for logging variables with Spellslinger's 'persistent data' mod. That was waaaaaaaay over my head :(
     
  15. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    1
    The throne w/ hole is an object? That gives me plenty of ideas :)
     
Our Host!