irswat Posted March 11, 2014 Share Posted March 11, 2014 (edited) scn SniperModScript float hfPlayer int AlertFlag ref rSniper set rSniper to GetSelf set hfPlayer to 0 set AlertFlag to 0 set rSniper to 00000000 set hfPlayer to rSniper.GetDistance player begin GameMode MessageEx "Sniper Mod Debug Game Mode" if rSniper.GetDead == 0 MessageEx "Sniper %i is %g units away" rSniper hfPlayer elseif rSniper.GetDead MessageEx "Sniper %i is dead" rSniper set hfPlayer to -72 endif if hfPlayer <= 8000 if hfPlayer != -72 set AlertFlag to 1 endif elseif hfPlayer > 8000 set AlertFlag to 0 MessageEx "Player out of range by %g units." (hfPlayer-8000) endif if AlertFlag == 1 if player.GetDead == 0 Look rSniper rSniper.Look player MessageEx "Player within range. Firing." rSniper.UseWeapon WeapNVGhillieSniperRifle rSniper player 6 0 0 1 0 endif if player.GetDead == 1 set AlertFlag to 0 endif endif end Specifically the highlighted portion. Should this declaration/initialization be inside the Begin GameMode section, or before it as I have it? The reason I am asking is for some reason or another these variables do not seem to be refreshing/updating. I have 4 snipers and the debug messages will go through them one by one, but whether they are alive or dead, and how far away they are isnt changing for some reason. I thought maybe it's because of the declaration/initialization Edited March 11, 2014 by irswat Link to comment Share on other sites More sharing options...
rickerhk Posted March 11, 2014 Share Posted March 11, 2014 This stuff needs to be in the gamemode block: set rSniper to GetSelf set hfPlayer to 0 set AlertFlag to 0 set rSniper to 00000000 set hfPlayer to rSniper.GetDistance player And FYI, if you spawn the actor with PlaceAtMe, GetSelf will always return zero. Link to comment Share on other sites More sharing options...
irswat Posted March 11, 2014 Author Share Posted March 11, 2014 (edited) thank you. any idea from this script why the distance never updates? Edited March 11, 2014 by irswat Link to comment Share on other sites More sharing options...
Recommended Posts