return spawn

Discussions about Coding and Scripting

return spawn

Postby Rakiayn » Sun Jul 31, 2011 12:15 pm

return Spawn(ProjClass,,, Start,AdjustedAim);

what does this line of code do, besides spawning a projectile
I want to replace it with this:
s = Spawn(ProjClass,,, Start,AdjustedAim);
because I want to alter this projectile
can I savely do this or do I break something this way?
User avatar
Rakiayn
Masterful
 
Posts: 512
Joined: Fri Aug 28, 2009 3:33 pm

Re: return spawn

Postby >@tack!< » Sun Jul 31, 2011 12:24 pm

this is from function Projectile ProjectileFire(class<projectile> ProjClass, float ProjSpeed, bool bWarn)

you need to return a projectile so it can fire it.
you can do it like this for example:
s = Spawn(ProjClass,,, Start,AdjustedAim);
s.Speed *= 0.5;
return s;

i think :p
User avatar
>@tack!<
Adept
 
Posts: 328
Joined: Sat Apr 17, 2010 4:51 pm
Personal rank: lol?

Re: return spawn

Postby Rakiayn » Mon Aug 01, 2011 12:35 pm

well withouth the return s;
it seems to work the same :???:
User avatar
Rakiayn
Masterful
 
Posts: 512
Joined: Fri Aug 28, 2009 3:33 pm

Re: return spawn

Postby Shadow » Mon Aug 01, 2011 1:03 pm

s is in >@tack!<'s case just a variable designation for the actor the spawn function returns. the variable s equals to the actor factorized by the spawn function. to return the spawn function only or a variable equal to it doesn't really matter, except you want to modify the spawned actor
Last edited by Shadow on Mon Aug 01, 2011 1:12 pm, edited 1 time in total.
Image
User avatar
Shadow
Masterful
 
Posts: 666
Joined: Tue Jan 29, 2008 12:00 am
Location: Halle (Saale), Germany

Re: return spawn

Postby >@tack!< » Mon Aug 01, 2011 1:12 pm

ah ofcourse ^^
User avatar
>@tack!<
Adept
 
Posts: 328
Joined: Sat Apr 17, 2010 4:51 pm
Personal rank: lol?


Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 0 guests