HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

one spring per player??

08-22-2003, 12:41 AM#1
Hunter0000
I am trying to make a trigger that only springs once per player but whatever I do it wont stop, here is the curret trigger:

Events

Unit - A unit comes within 500.00 of Inn (heal) 0007 <gen>

Conditions

((Triggering unit) is A Hero) Equal to True

Actions

If (P1 Equal to Farmer (Male) 0008 <gen>) then do (Game - Display to Player Group - Player 1 (Red) the text: This is the empire ...) else do (Do nothing)

(5 reapeats only changing the player and the varible)

If ((P1 Equal to Farmer (Male) 0008 <gen>) and ((Owner of (Triggering unit)) Equal to Player 1 (Red))) then do (Set P1 = (Triggering unit)) else do (Do nothing)

(5 reapeats only changing the player and the varible)

P1, P2 P3.. ect all are Farmer (Male) 0008 <gen> as of the spring of this trigger
08-22-2003, 12:45 AM#2
DaKaN
there is no reason for it to stop, this isnt like starcraft where you need a special command to keep the trigger alive.

You need to add something to make it not fire a 2nd time. If they were all seperate triggers, you could just turn it off.

You could also add a boolean variable, and when it fires for player1, turn boolean[1] = true

then in the conditions for the IF statment, make it owner of triggering unit is player 1 AND boolean[1] = false
08-22-2003, 12:51 AM#3
Hunter0000
but shouldnt what I have work? it says if the players Variable unit is a farmer then it give u the msg then it changes the unit Variable, shouldnt that stop it from fireing as the conditions to the action are no longer met?
08-22-2003, 01:12 AM#4
DaKaN
ah i didnt see that 2nd part heh

well what is the triggering unit... what is its variable name
08-22-2003, 01:26 AM#5
Hunter0000
The variables are P1, P2, P3... ect
08-22-2003, 01:35 AM#6
MarSara
Here's any easier way to make any trigger file once for each player. ButFirst you need to create a varaible of type Boolean array (call it Registry for now) and set it's initial value to false.

Code:
Events:
    <Whatever>
Conditions:
    <Whenever>
Actions:
    if( Registry[PlayerNumber( <Triggering Player>)] == true ) then
        SkipRemainingActions()
    else
        set Registry[PlayerNumber( <Triggering Player>)] = true
    endif
    // Do somthing...
Make sure to replace <Triggering Player> with the correct function for the event (TriggeringPlayer, OwnerOf(TriggeringUnit), etc...)

There might even be an easier way, but I don't know if this will cause a server split: (If this works you wont need any varaibels)

Code:
Actions:
    For ( (integerA) = 0 to 11 )
        CustomScript "if( LocalPlayer() == Player(GetForLoopIndexA()) then"
             Trigger-TurnOff(ThisTrigger)
        CustomScript "endif"
    Next
And sorry, I don't have my editor open, so I don't know the correct function names.
08-22-2003, 01:39 AM#7
Hunter0000
Quote:
Originally posted by MarSara
Here's any easier way to make any trigger file once for each player. ButFirst you need to create a varaible of type Boolean array (call it Registry for now) and set it's initial value to false.

Code:
Events:
    <Whatever>
Conditions:
    <Whenever>
Actions:
    if( Registry[PlayerNumber( <Triggering Player>)] == true ) then
        SkipRemainingActions()
    else
        set Registry[PlayerNumber( <Triggering Player>)] = true
    endif
    // Do somthing...

And sorry, I don't have my editor open, so I don't know the correct function names.


That is ensenily what I did, exept with multiple unit varables instead of one boolean array
08-22-2003, 01:51 AM#8
Newhydra
...What unit are you triggering it with I have a feeling you're using the farmer guy to set off the trigger so it's setting p1=triggering unit. If that's not the case then it's because you use triggering unit when you should use entering unit...probably....look through the event responses to make sure there's not one for "unit comes in range" or some such thing first...
08-22-2003, 01:59 AM#9
Hunter0000
Ok that is a good idea now to open up WE

*click....click,click......click,click.......click,click,click


nope, but my trigg keeps on getiing wierder

because the unit variable affects the camera I know its being changed to the player'd hero, howwever it still sends the msg, uhh WTF man just WTF is going on!!!
Ã?
08-22-2003, 02:09 AM#10
Newhydra
Okay, add in 3 printouts...in the first if statement stick "display to player the text unit-type of p1"

Then copy and paste it just after the first one runs (probably un needed)

Then copy and paste it and stick it in the 2nd if statement after you change the variable

Also stick a print(anything) in the else of the 2nd if statement and see what happens when you move the hero in and out a couple times.

(is the first if firing but the 2nd going into the else part? are they both firing?)

Normally I wouldn't think any of this needed but you clearly have somethin' goin on ;)
08-22-2003, 02:19 AM#11
Hunter0000
What???????? I cant find anything, anywhere about a printout or tell player unit-type
08-22-2003, 04:20 AM#12
Newhydra
*sigh* When I said print I meant "display text to player blah blah blah" and you can, in there, say convert unit type to string, and go "display unit type of unit p1" (or near that)
08-22-2003, 05:02 PM#13
Hunter0000
Sry but, when it comes to stripts and programing experiance im about equil to my grandmother, so could you tell me how?
08-22-2003, 10:34 PM#14
Newhydra
What is so hard to understand? You've used it in your trigger already, read what I say and use that as the goal to achieve, when I say display text to player, I mean I want you to display some text to a player, so the player can see it...For example: Game - Display to Player Group - Player 1 (Red) the text: This is the empire ...) else do (Do nothing)
08-23-2003, 12:26 AM#15
Hunter0000
EDIT: nm im an idiot im running it now....