Post your scripting questions / solutions here
Moderator: Moderators
agentmad007
Brigadier General
Posts: 570 Joined: Tue Feb 24, 2004 3:52 pm
Post
by agentmad007 » Thu Nov 25, 2004 3:01 pm
Hi all ,
I cant make work this script below.
Some precisions before:
$sg_document is a
script_object
$axis_view_map_trigger is a
trigger_use wich
setthread axis_view_map.
AxisHQ is a big
trigger_multiple
i would like the player to momorise the map en run back to his spawn point to achieve the objective.Here is what i tried but nothing work .
Code: Select all
axis_view_map local.player:
while (local.player.dmteam != axis)
{
if ( (Isalive local.player) && (local.player.useheld == 1) && (local.player cansee $sg_document 60 80) )
if ( local.player.seenmap == 1 )
{
iprintln "You have memorised the document" local.player.dmteam
}
end
}
thread come_back_home
end
come_back_home:
self.seenMap = 1
while ( self != NULL )
{
if ( ! (Isalive self) )
{
iprintln "You've been mupped!"
self.seenMap = 0
end
}
if ( self.dmteam != "axis" )
{
iprintln "objective failed"
self.seenMap = 0
end
}
for (local.i = 1; local.i <= $AxisHQ.size; local.i++) {
if ( self isinside $AxisHQ[local.i] )
{
iprintln "Good job!!!!"
thread stargate_document_in_possession
end
}
}
wait 0.1
}
end
stargate_document_in_possession:
level.axis_obj++
thread check_endmatch
end
check_endmatch:
if (level.axis_obj == level.numobjectives)
teamwin axis
end
thx for help
tltrude
Chuck Norris
Posts: 4774 Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:
Post
by tltrude » Thu Nov 25, 2004 7:19 pm
You need to put this line at the start of the first thread.
Local.player = parm.other
That line assigns the values of the player (the one that hit the trigger use) to the "local.player" variable in that thread.
You also need to assign the new parammeter/value to that player.
local.player.seenmap = 1
Hope that helps!
Tom Trude,
agentmad007
Brigadier General
Posts: 570 Joined: Tue Feb 24, 2004 3:52 pm
Post
by agentmad007 » Thu Nov 25, 2004 8:43 pm
Code: Select all
axis_view_map local.player:
local.player = parm.other
while (local.player.dmteam != axis)
{
if ( (Isalive local.player) && (local.player.useheld == 1) && (local.player cansee $sg_document 60 80) )
if ( local.player.seenmap == 1 )
{
iprintln "You have memorised the document" local.player.dmteam
}
end
}
thread come_back_home
end
come_back_home:
local.player.seenMap = 1
while ( self != NULL )
{
if ( ! (Isalive self) )
{
iprintln "You've been mupped!"
local.player.seenMap = 0
end
}
if ( self.dmteam != "axis" )
{
iprintln "objective failed"
local.player.seenMap = 0
end
}
for (local.i = 1; local.i <= $AxisHQ.size; local.i++) {
if ( self isinside $AxisHQ[local.i] )
{
iprintln "Good job!!!!"
thread stargate_document_in_possession
end
}
}
wait 0.1
}
end
stargate_document_in_possession:
level.axis_obj++
thread check_endmatch
end
check_endmatch:
if (level.axis_obj == level.numobjectives)
teamwin axis
end
still doesn't want to work .
tltrude
Chuck Norris
Posts: 4774 Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:
Post
by tltrude » Thu Nov 25, 2004 8:58 pm
seenMap ???
should be
seenm ap
Use some debug lines like these.
iprintln "the trigger has been used!"
iprintln "local.player.seenmap = " (local.player.seenmap)
By the way, "mupped" has no meaning in english, and "memorised" is spelled "memorized".
Tom Trude,
agentmad007
Brigadier General
Posts: 570 Joined: Tue Feb 24, 2004 3:52 pm
Post
by agentmad007 » Thu Nov 25, 2004 9:14 pm
I cant use the debug , coze the whole script doesn't work , as if i got a syntax error.But only this part of script is bugged.when I try my whole script with these lines below , nothing wotk anymore .....however when i take out these lines the rest of the objectives work.
Code: Select all
axis_view_map local.player:
local.player = parm.other
while (local.player.dmteam != axis)
{
if ( (Isalive local.player) && (local.player.useheld == 1) && (local.player cansee $sg_document 60 80) )
if ( local.player.seenmap == 1 )
{
iprintln "You have memorised the document" local.player.dmteam
}
end
}
thread come_back_home
end
come_back_home:
local.player.seenmap = 1
while ( self != NULL )
{
if ( ! (Isalive self) )
{
iprintln "You've been mupped!"
local.player.seenmap = 0
end
}
if ( self.dmteam != "axis" )
{
iprintln "objective failed"
local.player.seenmap = 0
end
}
for (local.i = 1; local.i <= $AxisHQ.size; local.i++) {
if ( self isinside $AxisHQ[local.i] )
{
iprintln "Good job!!!!"
thread stargate_document_in_possession
end
}
} ==> i deleted this array also just before waitframe
it was wait .01 before , i ve changed it
tltrude
Chuck Norris
Posts: 4774 Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:
Post
by tltrude » Thu Nov 25, 2004 9:34 pm
Local.player will lose it's value when it sees "end"---, local only works in the "local" thread.
thread come_back_home
end
come_back_home:
local.player.seenmap = 1
----------------------------------
try this----
thread come_back_home local.player
end
come_back_home local.player:
local.player.seenmap = 1
Tom Trude,
agentmad007
Brigadier General
Posts: 570 Joined: Tue Feb 24, 2004 3:52 pm
Post
by agentmad007 » Thu Nov 25, 2004 9:39 pm
same
none objectives work .....
agentmad007
Brigadier General
Posts: 570 Joined: Tue Feb 24, 2004 3:52 pm
Post
by agentmad007 » Thu Nov 25, 2004 9:45 pm
also tried
Code: Select all
local.player thread come_back_home
end
come_back_home:
..............
..........
.....
agentmad007
Brigadier General
Posts: 570 Joined: Tue Feb 24, 2004 3:52 pm
Post
by agentmad007 » Thu Nov 25, 2004 11:24 pm
Now it work
changed the structure.
Thx anyway Tom