Raised This Month: $32 Target: $400
 8% 

[?]Set_task help!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
heliumdream
Senior Member
Join Date: Aug 2006
Old 11-18-2006 , 16:49   [?]Set_task help!
Reply With Quote #1

I used this page for reference... http://wiki.amxmodx.org/index.php/Advanced_Scripting_%28AMX_Mod_X%29

To make a long story short, I'm trying to make a bazooka hero that will fire more than one missile on a given keydown. Here is what I was attempting...

Code:
//Original Code
        switch(icmd){
            case 1: make_rocket(id,icmd,get_cvar_num("armageddon_speed"),0)
            case 2: make_rocket(id,icmd,get_cvar_num("armageddon_speed"),0)
            case 3: make_rocket(id,icmd,get_cvar_num("armageddon_speed"),0)
            case 5: make_rocket(id,icmd,get_cvar_num("armageddon_hsspeed"),0)
            case 6: make_rocket(id,icmd,get_cvar_num("armageddon_rsspeed"),0)
            case 7: make_rocket(id,icmd,get_cvar_num("armageddon_sdspeed"),0)
            default: make_rocket(id,icmd,get_cvar_num("armageddon_speed"),0)
Code:
//New Code
case 1: set_task(0.3, "make_rocket(id,icmd,1000,0)",id,"",0,"a",10)
I tried doing this, and it worked, only it didn't create any baz entities...it would let you know with the client_print that it was trying to fire, only nothing was getting created.
And, it's like it only excutes once. You only get 1 message, not 10. It should be running 10 times correct? Any thoughts or help will be appreciated.
Thanks in advance,
-helium

-Edit-
I also tried this, and the baz's would create properly, only too close together. They would just collide with one another and explode immediately, killing you =D. If I had a way to control the time and make them fire off fractions of seconds apart, it would be alright I guess - this is what lead me to think I need to use a set_task.
Code:
//More Code
case 1:
{
 make_rocket(id,icmd,get_cvar_num("armageddon_speed"),0) 
 make_rocket(id,icmd,get_cvar_num("armageddon_speed"),0)
 make_rocket(id,icmd,get_cvar_num("armageddon_speed"),0)
}

Last edited by heliumdream; 11-18-2006 at 16:54.
heliumdream is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-18-2006 , 17:04   Re: [?]Set_task help!
Reply With Quote #2

that is not how set_task works. heres what it should look like
Code:
some_function(id)
{
//heres your set_task
new parm[5]
parm[0] = id
parm[1] = icmd
parm[2] = get_cvar_num("armageddon_speed")
parm[3] = 0
set_task(0.3, "delayed_rockets", id, parm, 4, "a", 10)
}
public delayed_rockets(parm[])
{
make_rocket(parm[0],parm[1],parm[2],parm[3])
}
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
heliumdream
Senior Member
Join Date: Aug 2006
Old 11-18-2006 , 21:04   Re: [?]Set_task help!
Reply With Quote #3

Alrighty! Thank you for the detailed explanation. I looked for a script to try and find something for referrence, but I couldn't find one...
-edit- the same script has an example *slaps forehead* DOH!

Once again, you're the man.

Can we add this to that amx_scripting wiki? Like with a comment?
http://wiki.amxmodx.org/index.php/Ad...28AMX_Mod_X%29

Last edited by heliumdream; 11-18-2006 at 23:03.
heliumdream is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 11-20-2006 , 12:06   Re: [?]Set_task help!
Reply With Quote #4

no its self explanitory u just didnt catch it.
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode