Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!
Moderator: Core Staff
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » January 22nd, 2013, 2:13 am
Code: Select all
level.trap1_trig waittill("trigger", player);
player iprintln("Hit");
If you are using a trigger_damage.
Code: Select all
level.trap1_trig waittill("damage", damage, player);
player iprintln("Hit: " + damage + " damage");
In regards to the accumulate key/value, I a not sure how well those built in methods work, its very easy to create a accumulating damage monitor.
Code: Select all
level.trap1.dmg = 0;
level.trap1.hp = 500;
while(1)
{
  level.trap1_trig waittill("damage", damage, player);
  level.trap1.dmg += damage;
 Â
  player iprintln("Hit: " + damage + " damage");
Â
  if(level.trap1.dmg > level.trap1.hp)
   break;
}
For reference, when posting CoDScript use "
Code: Select all
" instead of just "[code]". A lot easier to read and numbered lines.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
ExPie
- CJ Wannabe
- Posts: 28
- Joined: January 20th, 2013, 10:56 pm
Post
by ExPie » January 22nd, 2013, 2:18 pm
Code: Select all
player iprintlnbold("Now hit a target!");
Â
How can you print only to one player? It gieves an error unknown entety player but if I use the function to print to all players (just function) its ok.
-
Rezil
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » January 22nd, 2013, 2:31 pm
ExPie wrote:
How can you print only to one player? It gieves an error unknown entety player but if I use the function to print to all players (just function) its ok.
This is one way of getting a specific player:
Code: Select all
p = getentarray("player", "classname");
for(i=0;i<p.size;i++)
    p[i] iprintln("Hello "+p[i].name);
You would probably want to get the player after they trigger a certain type of trigger, like so:
Code: Select all
t = getent("your_trigger", "targetname");
Â
t waittill("trigger", player);
player iprintln("Hello "+player.name+"!");
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
ExPie
- CJ Wannabe
- Posts: 28
- Joined: January 20th, 2013, 10:56 pm
Post
by ExPie » January 22nd, 2013, 2:59 pm
But I still cannot print to a single player due to player is an array and therefore not an entity.
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » January 22nd, 2013, 3:30 pm
In this scenario, the variable called "player" is a single entity. Specifically, it is the player who triggered the trigger.
You can change the word "player" to whatever you want
Code: Select all
t waittill("trigger", theDudeWhoTriggeredTheTrigger);
theDudeWhoTriggeredTheTrigger iprintlnbold(theDudeWhoTriggeredTheTrigger.name + " triggered the trigger");
We only use "player" as a standardised reference (such as i = int, f = float, e = entity)
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
ExPie
- CJ Wannabe
- Posts: 28
- Joined: January 20th, 2013, 10:56 pm
Post
by ExPie » January 22nd, 2013, 3:39 pm
Ok thx. This works now
In radiant I have set the trigers of targets(dmg triggrers) not to be triggered by anything else but rifle("spawnflags", "125", I also removed the accumulate key). Not when I run the map with /map it triggers only with granade. When I run it with /devmap it triggers by everything. How to fix this?
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » January 22nd, 2013, 4:08 pm
Get rid of all spawnflags, the can often be more hassle than they are worth.
When using the trigger_damage use "waittill ("damage", damage, player);"
All damage should be detected.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
ExPie
- CJ Wannabe
- Posts: 28
- Joined: January 20th, 2013, 10:56 pm
Post
by ExPie » January 22nd, 2013, 5:15 pm
What if I don't want them to be triggered unless it is by rifle?
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » January 22nd, 2013, 6:17 pm
Then you may be forced to use the spawnflags, if they work (been a long time). There is probably a way to detect what caused the damage, but I cannot think of it, hopefully someone else may know or can find out.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
ExPie
- CJ Wannabe
- Posts: 28
- Joined: January 20th, 2013, 10:56 pm
Post
by ExPie » January 22nd, 2013, 6:20 pm
So why doesnt it activate on /map exept for nades
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » January 22nd, 2013, 6:28 pm
You could manually add a `damage trigger` kind of thing. (Well in CoD4 and later games I'm pretty sure you can). If you get the entity and give it entity.health, and then do a damage callback function where damage = 0 if eAttacker.weapon != rifle or whatever.
And once entity.health <= 0 then do whatever action it was.
-
-
ExPie
- CJ Wannabe
- Posts: 28
- Joined: January 20th, 2013, 10:56 pm
Post
by ExPie » January 22nd, 2013, 8:38 pm
So its kinda broken? That it doesn't work as it should?
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » January 22nd, 2013, 10:03 pm
ExPie wrote:So its kinda broken? That it doesn't work as it should?
I don't know much(or anything) about spawnflags or adding triggers in radiant, my above post is just a work-around if you cannot get the spawnflag thing to work.
-
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » January 23rd, 2013, 10:27 pm
In CoD4 you can do this:
Code: Select all
self waittill ( "damage", amount, attacker, direction_vec, point, type );
if(type == "MOD_RIFLE_BULLET")
/* Target hit by rifle */
To test for another CoD do
Code: Select all
self waittill ( "damage", amount, attacker, direction_vec, point, type );
iprintln("Type: " + type);
And see what is printed.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
ExPie
- CJ Wannabe
- Posts: 28
- Joined: January 20th, 2013, 10:56 pm
Post
by ExPie » January 24th, 2013, 11:45 am
Ok so i figured out the trigger is not moving along with the ent.
Code: Select all
get_target_trig() {
level.target1 = getent ("target1", "targetname");
level.target1_trig = getent ("target1_trig", "targetname");
level.target1_trig enableLinkTo();
level.target1_trig linkTo(level.target1);
level.target2 = getent ("target2", "targetname");
level.target2_trig = getent ("target2_trig", "targetname");
level.target2_trig enableLinkTo();
level.target2_trig linkTo(level.target2);
level.target3 = getent ("target3", "targetname");
level.target3_trig = getent ("target3_trig", "targetname");
level.target3_trig enableLinkTo();
level.target3_trig linkTo(level.target3);
level.target4 = getent("target4", "targetname");
level.target4_trig = getent ("target4_trig", "targetname");
level.target4_trig enableLinkTo();
level.target4_trig linkTo(level.target4);
level.target5 = getent ("target5", "targetname");
level.target5_trig = getent ("target5_trig", "targetname");
level.target5_trig enableLinkTo();
level.target5_trig linkTo(level.target5);
}
And another question. Is there a function you can call to end anoter function?
Users browsing this forum: No registered users and 0 guests