Hmm well i'll get to the point , i have the bot code ,and this part of it handles dodging projectiles , thats fine , but the thing is , i'm doing this system below to tell the bot how long away the firer is going to fire again.
my problem is that it's suppost to send a message to the projectile cog ( each weapon has it's own cog for now ) and it will send back the infromation to the bot giving it the time the bullets been in the air and how long until it the parent fires again ( 10 units = 1 second)
Heres the reciving cog .... ( projectile cog )
I've tried all different kinds of SendMessage codes but none seem to work , help ???
Code:
projectile2 = FirstThingInView(rbot, 270, 1.0, 0x8); while(rbot == GetThingParent(projectile2) && projectile2 != -1) {projectile2 = NextThingInView();} if(getthingtemplate(projectile2) == ghost) projectile2 = NextThingInView(); if(projectile2 != -1) { if(!BitTest(botmode, 0x4000 && getthingparent(projectile2)) != rbot) { target=getthingparent(projectile2); botmode=BitSet(botmode,0x4000); // bot has target if (!BitTest(botmode,0x20000)) call firetarget2; // if bot not already attacking - attack new target } dot=ThingViewDot(projectile2, rbot); parent=getthingparent(projectile2); SendMessageEx(GetThingCaptureCog(projectile2), user1, rbot, -1, -1, -1); distance=VectorDist(GetThingPos(parent), GetThingPos(rbot)); if(dot > 0.85 && dot < 1.15 && HasLOS(rbot, projectile2)) //If it's gonna strike { if(!BitTest(botmode, 0x4000)) AiSetLookPos(rbot, getthingpos(projectile2)); call sidestep; if(gettemplate(projectile2) == projectile_weap7 || gettemplate(projectile2) == projectile_weap9) call jump; } } if(dot > 0.85 && dot < 1.15 && HasLOS(rbot, projectile2)) //If it's gonna strike { if(!BitTest(botmode, 0x4000)) AiSetLookPos(rbot, getthingpos(projectile2)); call sidestep; if(gettemplate(projectile2) == projectile_weap7 || gettemplate(projectile2) == projectile_weap9) call jump; } if(time != -1 && HasLOS(rbot, parent)) { if(time != firetime) time=time+1; if(time == firetime) call sidestep; if(time == firetime) time=-1; prediction=time-firetime; if(prediction > 2 && prediction < 4) call sidestep; }
my problem is that it's suppost to send a message to the projectile cog ( each weapon has it's own cog for now ) and it will send back the infromation to the bot giving it the time the bullets been in the air and how long until it the parent fires again ( 10 units = 1 second)
Heres the reciving cog .... ( projectile cog )
Code:
# Jedi Knight Cog Script # # 00_SMOKETRAIL.COG # # Leave a smoke trail behind a moving object # # [YB] # # (C) 1997 LucasArts Entertainment Co. All Rights Reserved flags=0x240 symbols thing bullet local int time=0 local local int firetime=12 local thing rbot local message created message pulse message removed message user1 end # ======================================================================================== code created: bullet = GetSenderRef(); SetPulse(0.1); Return; # ........................................................................................ pulse: time=time+1; return; removed: SetPulse(0); time=0; Return; user1: rbot=getparam(0); SendMessageEx(GetThingClassCog(rbot), user0, time, firetime, 0, 0); return; end
I've tried all different kinds of SendMessage codes but none seem to work , help ???