AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   NS - Simulating Spores/Umbra (https://forums.alliedmods.net/showthread.php?t=11334)

KCE 03-15-2005 22:35

NS - Simulating Spores/Umbra
 
Basically what I'm trying to do is to make the onos release a cloud of spores around himself every two seconds while he is digesting. Problem I'm having is the damage of the spores.

It would be easier if I could just call all of this in one function: create the spores and make them last for 7 seconds, do damage to all players within the defined radius for the same number of seconds the spores appear. It's pretty much identical as if a lerk was shooting spores at an onos every two seconds. I have the code for the spores effect and the damage, but not the timing.

How do I simulate spores as if the lerk has just fired a spore? I have an idea of how to create the effect and do damage but the damage is only done once every time the effect is simulated, instead of : every second do damage for seven seconds like when a lerk does it. I was looking at the sporemines plugin, it had what I needed but I was having trouble implementing it.

Here's what I got so far for drawing spores wherever the player(id) is:
Code:
public drawsmspores(id) {     new Float:origin[3]     pev(id,pev_origin,origin)     emit_sound(id,CHAN_ITEM,song_spore,0.8,ATTN_NORM,0,PITCH_NORM)     playback_event(0,id,g_EventParticle,0.0,origin,Float:{0.0,0.0,0.0},0.0,0.0,13,0,0,0) //spore effect }

After I call the spore visual effects, I then call another function to do damage to all the player's within the defined range. The problem I'm having is how to keep the damage to keep on damaging for a certain number of seconds (the length of time the spores appear).

The part in sporemines I need, is when the player triggers the mine and causes it to release spores.

Thanks

XxAvalanchexX 03-16-2005 13:47

Code:
#define DAMAGE_TASK_ID 27 public release_teh_spores(id) {    new origin[3];    get_user_origin(id,origin);    // spore graphics here    new parms[4];    parms[0] = origin[0];    parms[1] = origin[1];    parms[2] = origin[2];    parms[3] = 1; // current iteration    set_task(1.0,"damage",DAMAGE_TASK_ID,parms); } public damage(parms[]) {    // grab origin from parms    new origin[3];    origin[0] = parms[0];    origin[1] = parms[1];    origin[2] = parms[2];    // do your damage code here    parms[3]++; // add to iteration    // if we still have some more iterations to go    if(parms[3] <= 7) {       set_task(1.0,"damage",DAMAGE_TASK_ID,parms);    } }

KCE 03-16-2005 18:13

Thanks for the tip. I'm having a problem in-game with invalid player. I've been able to fix it by checking if user is connected but then it doesn't do damage. It keeps saying this:

Code:

L 03/16/2005 - 16:18:31: [Engine] Invalid player 0 (not in-game)
L 03/16/2005 - 16:18:32: [AMXX] Native error in "entity_range" on line 164 (file "onos_gas.sma").


XxAvalanchexX 03-16-2005 22:14

You are checking with is_valid_ent(i) . Use is_user_connected(i) and that should fix it up.

Also, parms[1] is the Y value of the origin, not the full origin vector.

KCE 03-16-2005 22:47

Alright figured it out. 8) BTW, do you know how I would simulate umbra? I don't really know how to use the playback_event function. :( Generally I'd post NS questions in the modns.org forums, but they're down right now... :?


All times are GMT -4. The time now is 13:59.

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