Allbrother Posted July 27, 2023 Share Posted July 27, 2023 (edited) And I'm failing. And I don't know why. I've looked all over the script and it all feels like it should be working. So what I've done is appended the blob below to the area scripts. It's supposed to run once, roll 1d3 essentially and on 1 spawn level appropriate quest targets and on 2/3 spawn nothing and instead increment a global that when maxed (by running in other target areas) will spawn the targets regardless of the random roll. But it's spawning the quest targets in the first area visited 100% of the time for some reason. What am I doing wrong? Spoiler IF LevelLT(Player1,4) //if lvl <4 Global("wl_oublek_gnolls","GLOBAL",1) //and quest is active and hasn't spawned yet !Global("wl_oublek_gnolls_rolled","LOCALS",1) //and hasn't rolled in this area OR(2) //and either... RandomNum(3,1) //rolls 1 on 1d3 Global("wl_oublek_gnolls_spawned","GLOBAL",3) //or max attempts/spawned THEN RESPONSE #100 CreateCreature("wl-t1g",[4500.3000],S) CreateCreature("wl-t1g",[4500.3000],S) CreateCreature("wl-t1g",[4500.3000],S) CreateCreature("wl-t1g",[4500.3000],S) CreateCreature("wl-t1g",[4500.3000],S) CreateCreature("wl-t1g",[4500.3000],S) CreateCreature("wl-t1g",[4500.3000],S) CreateCreature("wl-t1g",[4500.3000],S) CreateCreature("wl-t1g",[4500.3000],S) CreateCreature("wl-t2g",[4500.3000],S) SetGlobal("wl_oublek_gnolls","GLOBAL",2) //advance the quest to spawned SetGlobal("wl_oublek_gnolls_spawned","GLOBAL",3) //set to max attempts/spawned SetGlobal("wl_oublek_gnolls_rolled","LOCALS",1) //set to rolled in this area END IF LevelGT(Player1,3) //if lvl >3 LevelLT(Player1,7) //and lvl <7 Global("wl_oublek_gnolls","GLOBAL",1) //and quest is active and hasn't spawned yet !Global("wl_oublek_gnolls_rolled","LOCALS",1) //and hasn't rolled in this area OR(2) //and either... RandomNum(3,1) //rolls 1 on 1d3 Global("wl_oublek_gnolls_spawned","GLOBAL",3) //or max attempts/spawned THEN RESPONSE #100 CreateCreature("wl-t2g",[4500.3000],S) CreateCreature("wl-t2g",[4500.3000],S) CreateCreature("wl-t2g",[4500.3000],S) CreateCreature("wl-t2g",[4500.3000],S) CreateCreature("wl-t2g",[4500.3000],S) CreateCreature("wl-t2g",[4500.3000],S) CreateCreature("wl-t2g",[4500.3000],S) CreateCreature("wl-t2g",[4500.3000],S) CreateCreature("wl-t2g",[4500.3000],S) CreateCreature("wl-t3g",[4500.3000],S) SetGlobal("wl_oublek_gnolls","GLOBAL",2) //advance the quest to spawned SetGlobal("wl_oublek_gnolls_spawned","GLOBAL",3) //set to max attempts/spawned SetGlobal("wl_oublek_gnolls_rolled","LOCALS",1) //set to rolled in this area END IF LevelGT(Player1,7) //if lvl >7 Global("wl_oublek_gnolls","GLOBAL",1) //and quest is active and hasn't spawned yet !Global("wl_oublek_gnolls_rolled","LOCALS",1) //and hasn't rolled in this area OR(2) //and either... RandomNum(3,1) //rolls 1 on 1d3 Global("wl_oublek_gnolls_spawned","GLOBAL",3) //or max attempts/spawned THEN RESPONSE #100 CreateCreature("wl-t3g",[4500.3000],S) CreateCreature("wl-t3g",[4500.3000],S) CreateCreature("wl-t3g",[4500.3000],S) CreateCreature("wl-t3g",[4500.3000],S) CreateCreature("wl-t3g",[4500.3000],S) CreateCreature("wl-t3g",[4500.3000],S) CreateCreature("wl-t3g",[4500.3000],S) CreateCreature("wl-t3g",[4500.3000],S) CreateCreature("wl-t3g",[4500.3000],S) CreateCreature("wl-t4g",[4500.3000],S) SetGlobal("wl_oublek_gnolls","GLOBAL",2) //advance the quest to spawned SetGlobal("wl_oublek_gnolls_spawned","GLOBAL",3) //set to max attempts/spawned SetGlobal("wl_oublek_gnolls_rolled","LOCALS",1) //set to rolled in this area END IF !Global("wl_oublek_gnolls_spawned","GLOBAL",3) //if not at max attempts/spawned !Global("wl_oublek_gnolls_incr","LOCALS",1) //and hasn't incremented attempts in this area THEN RESPONSE #100 IncrementGlobal("wl_oublek_gnolls_spawned","GLOBAL",1) //increment attemps SetGlobal("wl_oublek_gnolls_rolled","LOCALS",1) //set to rolled in this area SetGlobal("wl_oublek_gnolls_incr","LOCALS",1) //set to incremented attempts in this area END IF Global("wl_oublek_gnolls_count","GLOBAL",10) //if all are dead Global("wl_oublek_gnolls","GLOBAL",2) //and quest hasn't advanced THEN RESPONSE #100 AddJournalEntry(@3,QUEST) //update journal SetGlobal("wl_oublek_gnolls","GLOBAL",3) //advance quest END Edited July 28, 2023 by Allbrother Quote Link to comment
SCO Posted July 27, 2023 Share Posted July 27, 2023 Well, I don't program weidu, but I wouldn't be surprised if one of the random functions in weidu, and if you're unlucky the only one, is actually random... At compile time\install time for weidu. You see, it's kind of handy to have such a function because you can make mods that randomize things but do not behave differently when a player expects something on a existing playthrough, for instance, I'm pretty sure the item randomizer mod doesn't roll at runtime, never the less it works fine for that, and it's a bit more efficient. Quote Link to comment
jastey Posted July 27, 2023 Share Posted July 27, 2023 "LOCALS" is for creature scripts. in areas you's need to use "MYAREA" (which would be for that area, only). I'm not sure why you include Global("wl_oublek_gnolls_spawned","GLOBAL",3) in your OR check? Ah, no, I got it. Quote Link to comment
Allbrother Posted July 28, 2023 Author Share Posted July 28, 2023 8 hours ago, jastey said: "LOCALS" is for creature scripts. in areas you's need to use "MYAREA" (which would be for that area, only). I'm not sure why you include Global("wl_oublek_gnolls_spawned","GLOBAL",3) in your OR check? Ah, no, I got it. Sigh, of course it was a silly mistake. Thank you, it works now Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.