assasination script in MP

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Gizzy (nl)
Sergeant Major
Posts: 101
Joined: Tue Dec 03, 2002 3:41 pm
Location: Netherlands
Contact:

assasination script in MP

Post by Gizzy (nl) »

I am trying to combine a random spawn script with the assassination script in a MP map. I did add the following script to my mymap.scr

Code: Select all

spawn_random_leader local.num: 
// find a spawnpoint 
local.spawnpoints = $("spawn" + local.num) 
// local.spawnpoints is now the list of available spawnpoints 
// find a random index 
local.index = randomint (local.spawnpoints.size - 1) + 1 
// randomint <max> returns a number between o and max 
// so randomint <size - 1> returns a number between o and 
// the number of spawnpoints - 1 
// after +1 local.index is a number between 1 and 
//the number of spawnpoints. 
local.spawnpoint = local.spawnpoints[local.index] 
// ordinary spawn code here, e.g. 
local.enemy = spawn models/human/allied_misc_manon.tik 
local.enemy.origin = local.spawnpoint.origin 
local.enemy.angles = local.spawnpoint.angles 
local.enemy.targetname = "leader" 
local.enemy.health = 200
thread target
end

Code: Select all

target:
If(IsAlive $leader)
$leader waittill death // if the leader is killed, then the mission will complete
thread theend
end

Code: Select all

theend:
iprintIn "The resistance leader has been killed. Mission completed!"
 waitframe
 teamwin axis
end
The manon (a request from JV_map :lol: ) is spawned randomly in the map (that is : at several places in the map are script_origin 's with targetname= spawn1) That part is working fine. But whenever I add the SECOND CODE (target) the manon won't spawn anymore...

What am I doing wrong?
greets, Gizzy (nl)

Image
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Re: assasination script in MP

Post by mohaa_rox »

[quote="Gizzy (nl)"]

Code: Select all

target:
If (IsAlive $leader)
$leader waittill death // if the leader is killed, then the mission will complete
thread theend
end
Ah hah! You see the If (IsAlive $leader)? The "if" must be in small letters. So

if (IsAlive $leader)
.......

Then it will work.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Gizzy (nl)
Sergeant Major
Posts: 101
Joined: Tue Dec 03, 2002 3:41 pm
Location: Netherlands
Contact:

Post by Gizzy (nl) »

ahhhh, you're kidding me...????? I tried and I tried..I searched on the internet...almost cried out loud..and started to think I could only make a bombing objective again...i instead of I...aja aja ajaa aj... :shock:

I could kiss you if this works... :lol: Thanx for your fast response..
greets, Gizzy (nl)

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Maybe you should check your console for errors if you have a problem.

I'm sure this one would've shown up.
Image
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

That's how I managed to furnish up my assassination tut. Checked the console. "If" was an unknown command. So I tried "if" and it worked.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Gizzy (nl)
Sergeant Major
Posts: 101
Joined: Tue Dec 03, 2002 3:41 pm
Location: Netherlands
Contact:

Post by Gizzy (nl) »

ok, i am convInced, next tIme i wIll check my console fIrst... 8) :lol:
greets, Gizzy (nl)

Image
Gizzy (nl)
Sergeant Major
Posts: 101
Joined: Tue Dec 03, 2002 3:41 pm
Location: Netherlands
Contact:

Post by Gizzy (nl) »

well, just around to say now it works... 8) together with the random spawn script...
greets, Gizzy (nl)

Image
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Gizzy (nl) wrote:I could kiss you if this works... :lol: Thanx for your fast response..
Come on! I'm ready!
Live to map, not map to live.
-mohaa_rox, .map
moderator
Gizzy (nl)
Sergeant Major
Posts: 101
Joined: Tue Dec 03, 2002 3:41 pm
Location: Netherlands
Contact:

Post by Gizzy (nl) »

smak smak.... shall I write a tutorial on this one ?
greets, Gizzy (nl)

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I think we already have a tutorial about this subject :roll:
Image
Gizzy (nl)
Sergeant Major
Posts: 101
Joined: Tue Dec 03, 2002 3:41 pm
Location: Netherlands
Contact:

Post by Gizzy (nl) »

yes, its a SP tut...

For Mp it doesn't work if you do it this way...
greets, Gizzy (nl)

Image
panTera
Brigadier General
Posts: 573
Joined: Wed Jan 29, 2003 11:46 pm
Location: The Netherlands
Contact:

Post by panTera »

sounds interesting to have an assassination objective;). One question though, what happens if one of the players of the defending team decides to spoil the fun and starts shooting at their own leader?
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Maybe someone great will come up with that. Every played CS? You know the as_tundra or as_highrise, someone gets to be the VIP. Maybe a MOD can make this, with a classname "VIP" and the enemy will win when the VIP is killed.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Gizzy (nl)
Sergeant Major
Posts: 101
Joined: Tue Dec 03, 2002 3:41 pm
Location: Netherlands
Contact:

Post by Gizzy (nl) »

pantera wrote:sounds interesting to have an assassination objective;). One question though, what happens if one of the players of the defending team decides to spoil the fun and starts shooting at their own leader?
then the other team wins...I already tested this...everyone can shoot the leader...but setting the health a little higher (1000) it will prevent teammates killing their leader by accident... This script together with the random spawnscript makes it much more difficult for the team who has to kill the leader...
greets, Gizzy (nl)

Image
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

That would be cool! Like CS, maybe someone can make some classname of VIP and make random selections of the leader. Then the denfending team will have to escort the VIP to the other side while the enemy has to kill him, probably like crossroads with snipers everywhere. Cool.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Post Reply