angelwraith Posted October 22, 2011 Share Posted October 22, 2011 (edited) <br> SCN SUBcazadorScript<br> <br> ref rCombatTarget <br> <br> BEGIN GameMode<br> <br> if GetCombatTarget<br> set rCombatTarget to GetCombatTarget<br> endif<br> <br> ; If (GetDistance rCombatTarget <= 100 )<br> ; If (GetDistance Player >= 500 )<br> ; placeatme SUBMiniNukeExplosion 1 ; I tried both placeatme and the kill line below it, and for some reason <br> ; kill ; whenever these are enabled the above script will not function anymore<br> ; EndIf<br> ; EndIf<br> <br> END ; GameMode<br> <br> <br> BEGIN OnDeath<br> If (GetDistance Player >= 500 )<br> placeatme SUBMiniNukeExplosion 1<br> EndIf<br> disable<br> markfordelete<br> <br> END ; OnDeath<br> <br><br><br><br>ok so you see the commented out section???<br>if its active the script will not return a value for rCombatTarget <br>if its commented out like it is rCombatTarget gets set the way its supposed to and works do do what i want mostly..<br>its cool that they detonate when they die (was the original plan) but i wasnt to trigger that death manually bill the killactor script <div><br></div><div><br></div><div><br></div><div>Oh! also i should remember to add that this creature is created via PlaceAtMe so getSelf is out the window</div><div>im wondering if there is some issue going on here related to this</div><div>(i hope this isnt a case where the functions reference parameters are not optional, ive looked but cant find anything on it)</div><div><br></div><div><br></div> crap i edited the message and the site bugged out leaving that^^ ill retype and repost the message in a minute Edited October 22, 2011 by angelwraith Link to comment Share on other sites More sharing options...
Skevitj Posted October 22, 2011 Share Posted October 22, 2011 SCN SUBcazadorScript ref rCombatTarget BEGIN GameMode if GetCombatTarget set rCombatTarget to GetCombatTarget endif If (GetDistance rCombatTarget <= 100 ) If (GetDistance Player >= 500 ) placeatme SUBMiniNukeExplosion 1 kill EndIf EndIf END BEGIN OnDeath If (GetDistance Player >= 500 ) placeatme SUBMiniNukeExplosion 1 EndIf disable markfordelete ENDSrry, just reposting it without all the damn controll characters everywhere. Happens to me all the time, I've found writing the scripts in notepad and copying them in saves a heap of time when using codebox. I'm looking at it now, will edit if I find anything. Link to comment Share on other sites More sharing options...
angelwraith Posted October 22, 2011 Author Share Posted October 22, 2011 SCN SUBcazadorScript ref rCombatTarget BEGIN GameMode if GetCombatTarget set rCombatTarget to GetCombatTarget endif ; If (GetDistance rCombatTarget <= 100 ) ; If (GetDistance Player >= 500 ) ; kill ; I tried both placeatme and the kill line below it, and for some reason ; placeatme SUBMiniNukeExplosion 1 ; whenever either of these are enabled the above script will not function anymore ; EndIf ; EndIf END ; GameMode BEGIN OnDeath If (GetDistance Player >= 500 ) placeatme SUBMiniNukeExplosion 1 EndIf disable markfordelete END ; OnDeath ok so you see the commented out section??? if its active the script will not return a value for rCombatTarget, if its commented out like it is rCombatTarget it gets set the way its supposed to and works and does what i want mostly.. its cool that they detonate when they die (was the original plan) but i wasnt to trigger that death manually with the killactor script when they get close to their targets. so i really need that section of code to not be commented out an be woking but either damage from the explosion killing them or the killactor (kill) command. Oh! also i ;should ;remember to add that this creature is created via PlaceAtMe so getSelf is out the window im wondering if there is some issue going on here related to this (i hope this isnt a case where the functions ;reference ;parameters are not optional, ive looked but cant find anything on it) any and all help/ideas are appreciated!! thank you. Link to comment Share on other sites More sharing options...
angelwraith Posted October 22, 2011 Author Share Posted October 22, 2011 @ Skevitj oh hey thanks!! didnt see that and went through myself and redid it, thanks for getting something understandable back up so quickly.. yeah its notepad++ from now on before i upload any comments.. love the formating it provides.. and when im dealing with script(often am) it makes it look natural to me before i post so i know ive not missed anything. Link to comment Share on other sites More sharing options...
Skevitj Posted October 22, 2011 Share Posted October 22, 2011 SCN SUBcazadorScript ref rCombatTarget BEGIN GameMode If (IsInCombat==0) return endif set rCombatTarget to GetCombatTarget If (GetDistance rCombatTarget > 100 ) return endif If (GetDistance Player < 500 ) return endif ;PlaceAtMe SUBMiniNukeExplosion 1 kill END BEGIN OnDeath If (GetDistance Player < 500 ) return endif PlaceAtMe SUBMiniNukeExplosion 1 disable markfordelete END I didn't really change much other than rearranging the logic and using IsInCombat instead of a null return from GetCombatTarget, but chuck that in and see if it works. I've got a feeling it's got something to do with it not liking how you're doing GetCombatTarget. If that doesn't work, try changing set rCombatTarget to GetCombatTarget to set rCombatTarget to this.GetCombatTarget Link to comment Share on other sites More sharing options...
angelwraith Posted October 22, 2011 Author Share Posted October 22, 2011 (edited) wouldnt the returns prevent the ondeath block from firing? its need to be free to fire whenever they die.. its pretty much the main point. like if someone shoots it before it hits the trigger zone. additionally using the refrence 'this' is exactly the same thing as using getself, its actually the shorthand for it, which when being used on creatures that were spawned with placeatme like these never returns a true value.. this is what the geck wiki reads and i can confirm it with testing in console and the creature variables never getting set. yeah i just tested it, its a no go. rCombatTarget is returning a null value. Edited October 22, 2011 by angelwraith Link to comment Share on other sites More sharing options...
Skevitj Posted October 23, 2011 Share Posted October 23, 2011 I switched the <= and >= for > and < respectively, the logic follows the exact same line as your original (except that disable/markfordelete won't be called unless they explode). Guess you need a new way of spawning them. Link to comment Share on other sites More sharing options...
angelwraith Posted October 23, 2011 Author Share Posted October 23, 2011 there is no other way to spawn them.. unless i am moving persistant references.. which is a no go as i dont want to deal with resurrecting and moving them each time. so i went a completely different route that instead of using distance it relies on time/damage and im pretty happy with the results. thanks for trying to help me figure this out though.. i really wish i knew why the game would quit acknowledging one bit of code because another bit is enabled after it.. i want to know why those lines prevent it from returning that variable.. that in their absence works as planned... soo confusing. Link to comment Share on other sites More sharing options...
rickerhk Posted October 23, 2011 Share Posted October 23, 2011 The getDistance function may be halting the script when rCombatTarget is null. It's a good idea to make sure a reference is non zero before performing functions on it SCN SUBcazadorScript ref rCombatTarget BEGIN GameMode set rCombatTarget to GetCombatTarget if (rCombatTarget) if (GetDistance rCombatTarget <= 100 ) if (GetDistance Player >= 500 ) kill ; I tried both placeatme and the kill line below it, and for some reason placeatme SUBMiniNukeExplosion 1 ; whenever either of these are enabled the above script will not function anymore EndIf EndIf endif END ; GameMode BEGIN OnDeath If (GetDistance Player >= 500 ) placeatme SUBMiniNukeExplosion 1 EndIf disable markfordelete END ; OnDeath Link to comment Share on other sites More sharing options...
Skevitj Posted October 23, 2011 Share Posted October 23, 2011 That wont make a difference rickerhk, have a look at the script I posted above, does pretty much the same thing, only gets/evaluates a combat target if there's a combat target to get. The problem seems to be in how the functions interact with a dynamically created creature. PlaceAtMe seems to be more trouble than it's worth, I had problems a while ago trying to assign ownership and other attributes to a dynamically created projectile... Ran into problems which seem very similar to these ones, never did figure out a way to get around it. Oh well, guess the best I can hope for is that one day they'll replace the scripting language with a compiled one and open up some more of the lower level stuff. It would be real useful to be able to code your own functions with the GECK, so you know how they actually work. Link to comment Share on other sites More sharing options...
Recommended Posts