Raised This Month: $ Target: $400
 0% 

Question Regarding Creating CTF Style Runes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MarquisEXB
Junior Member
Join Date: Mar 2008
Old 03-15-2008 , 23:29   Question Regarding Creating CTF Style Runes
Reply With Quote #1

New programmer here. I'm interested in creating a CTF style rune. For those that aren't familiar, a rune is an item you can pick up that will give you a special power (extra shot power, regeneration, etc). When a player is killed the run "falls" to the ground until it is picked up again.

The part I'm not sure how to program is the rune itself. Specifically I'm interested in any snippets of code that can help in:
- creating an item
- placing it in the same location as an entity (mainly how to move this item)
- detecting when a player "picks up that item"
- "ejecting" that item when the player is killed (I know how to "DeathMsg", but not sure how I would "spit" the item out).

If it matters, this is going to be for a small hl/op4 lan server. I'm thinking about using the sprites from op4ctf.wad's runes (if possible), but I guess I could use anything.

Thanks in advance, and I hope I posted this in the right spot.
MarquisEXB is offline
jasonf20
Junior Member
Join Date: Mar 2008
Old 03-16-2008 , 17:58   Re: Question Regarding Creating CTF Style Runes
Reply With Quote #2

well teh last 1 is ez u hook deathmsg and if the victomid = rune_holde_rid then u place the rune at his origin.

Note: im not sure this will owrk because i dont know if u can stillget the players origin once his dead

all the other issues are things i want know myself so help would be apprciated by me 2
jasonf20 is offline
MarquisEXB
Junior Member
Join Date: Mar 2008
Old 03-16-2008 , 22:15   Re: Question Regarding Creating CTF Style Runes
Reply With Quote #3

OK looking at the code to CSNadeDrops (http://forums.alliedmods.net/showthread.php?p=70493), I think there's some stuff in there to help. This appears to create an entity (a hegrenade in this example):

Code:
      new grenade = create_entity("info_target"); // create grenade entity
      entity_set_string(grenade,EV_SZ_classname,"fake_hegrenade"); // change name
      entity_set_int(grenade,EV_ENT_owner,id); // set owner
      entity_set_int(grenade,EV_INT_iuser1,0); // hasn't bounced yet

      // set grenade entity's size
      new Float:minbox[3] = { -2.5, -2.5, -2.5 }
      new Float:maxbox[3] = { 2.5, 2.5, 2.5 };
      entity_set_vector(grenade,EV_VEC_mins,minbox);
      entity_set_vector(grenade,EV_VEC_maxs,maxbox);

      // set grenade's overall being of a whole
      entity_set_int(grenade,EV_INT_solid,SOLID_TRIGGER);
      entity_set_int(grenade,EV_INT_movetype,MOVETYPE_TOSS);

      // set a random angle
      new Float:angles[3] = { 0.0, 0.0, 0.0 };
      angles[1] = float(random_num(0,180));
      entity_set_vector(grenade,EV_VEC_angles,angles);

      // get player's origin
      new Float:origin[3];
      entity_get_vector(id,EV_VEC_origin,origin);
      origin[0] += NADE_OFFSET; // offset

      // set model and origin
      entity_set_model(grenade,"models/w_hegrenade.mdl");
      entity_set_vector(grenade,EV_VEC_origin,origin);
There appears to be more code regarding if another player picks it up in that link.
MarquisEXB 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 23:44.


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