round doesnt end.


(isbowhten) #1

i post my script here… because… i have no idea why the round doesnt end…
with the help of printglobalaccum i found out that globalaccum 3 is 44
… well that’s exactly the value it should have


game_manager
{
   spawn
   {
wm_allied_respawntime 10
wm_axis_respawntime 10


wait 350
wm_set_defending_team 0
setstate one invisible     ( just ignore this. it isnt completed)
wm_set_round_timelimit 50
globalaccum 0 set 0   (if allies or axis activated the trigger multiple)
globalaccum 1 set 0    (counter for allies)
globalaccum 2 set 0   (counter for axis)
globalaccum 3 set 0   (counter counting all)
   }
}

tmul   (44 trigger_multiples which are targeted at 44 func_explosives= pieces of chocolate)
{
trigger activate_allies
{
printglobalaccum 0
globalaccum 0 set 1   (allies activated it)
}
trigger activate_axis
{
printglobalaccum 0
globalaccum 0 set 0  (axis activated it)
}
}

choco    (44 pieces of chocolate :), the func explosives)
{
death
{
//wm_endround   (i tried it here just to see if the command itself works)
trigger self allies   ( if allies activated it etc..)
trigger self axis   (if axis activated it etc...)
wait 1000
trigger self check  (cheks if all 44 explosives have been destroyed)
}
trigger allies
{
globalaccum 0 abort_if_equal 0    (if the axis activated, do not run the allies routine)
globalaccum 1 inc 1   (allied counter +1)
globalaccum 3 inc 1   (counter of all+1)
printglobalaccum 1      ( BTW: i tested it as an allied BUT printglobalaccum printed the accum 2 instead of the accum 1)
printglobalaccum 3
}
trigger axis
{
globalaccum 0 abort_if_equal 1    (if allies activated. do not run the axis routine)
globalaccum 2 inc 1     (axis counter)
globalaccum 3 inc 1     (counter of all)
printglobalaccum 2
printglobalaccum 3
}
trigger check
{

globalaccum 3 abort_if_not_equal 44         (checks who wins the game IF all 44 explosives are dead)
( printglobalaccum 3 says "44".. so it should run this routine. the printglobalaccum 3 command isnt in this routine! it is in trigger allies and trigger axis)
trigger self alwin  (if allies ate more of the chocolate than axis)
trigger self axwin  (if axis more than allies)
trigger self sudden  (if they have the same number of destroyed explosives)
wm_endround       (WHY DOES IT NOT END THE ROUND?)
// is heir eigtl noch falsch
}
trigger alwin
{
globalaccum 1 abort_if_less_than 22   (well 22 is half from 44)
wm_setwinner 1
}
trigger axwin
{
globalaccum 2 abort_if_less_than 22
wm_setwinner 0
}
trigger sudden
{
globalaccum 1 abort_if_not_equal 22 
//geht auch mit accum 2!          (something which isnt completed.. an extra piece of chocolate at a different place spawns )
setstate one default
//leitern baufähigmachen .. auf dach ist ein stück !
}
}



(-SSF-Sage) #2

I had just a quick look on the script. Have you tried to place the endround into the alwin/axwin/sudden triggers end, instead of check? Have you followed as it goes with g_scriptdebug 1? Also you could try to have a minimal wait before endround.

Also I didn’t find any setwinners, except those that are under possible aborting. In other words the map will hang on empty when the time expires, if the objs aren’t done, that might cause weird issues, but not here I think.

Also you might want to describe us how it should work generally. Like how the objective system should work. I got some idea from reading the script file, but you could be more detailed.

I also assume the script doesn’t really look like that, but you just added comments here.


(isbowhten) #3

ôk… 44 explosives which represent 44 pieces of chocloate are ready to be eaten… the team having eaten the most pieces of chocolate wins… i know this with endround… i didnt correct it beacause the rest doesnt work.
well … i didnt use scriptdebug, just printaccum … activate_allies and axis seems not to work… only activate… does it?


(-SSF-Sage) #4

But what do you have the explosives for? Shoot them? What is the trigger_multiple for? Scripting reference says: activate <axis|allies>, according to that there will not be _ between. The scriptdebug is for you to help to see if it executes what you want. For example to see if the endround gets executed.

Edit. and what you told about the obj system is what I understood. But tell me more about multiples and explosives.


(isbowhten) #5

the multiple is targeted at the explosives… i will change it a bit becaus it shouldn’t destroy the explosive immediately. the pieces of chocolate are not shootable: health = 0;
tmul is the scrpitname of all multiples… and choco is the scriptname of all explosives.
so it just explodes if you are near it…


(isbowhten) #6

g_scriptdebug says that only activate is executed… i changed the events in activate allies withou _ but it is still the same


(-SSF-Sage) #7

[QUOTE=isbowhten;175369]the multiple is targeted at the explosives… i will change it a bit becaus it shouldn’t destroy the explosive immediately. the pieces of chocolate are not shootable: health = 0
[/QUOTE]

Ahh, that is a creative idea I have to admit. I wonder why didn’t I guess that. :slight_smile:

That is funny cos it should work. But I tried it and there must be somekind of trick behind it to get it to work, which I’m not aware of, sry.

However you could use func_invisible_users instead, there it works for sure. This would require of course pressing them, but it would be A LOT cooler in my opinion. You could trick it to turn off after it is used with the delay key set to big numbers. I assume you used wait -1 for your trigger_multiples.

Edited:

Or you could have two trigger multiples for each choco, but this would ofc be a big mess, and would require longer script file. Or then just find a way to get through with that.


(isbowhten) #8

activate allies doesnt work… yes i could put a multiple fpr both teams… but still it doesnt end the round!!
:frowning: my actual script is


game_manager
{
   spawn
   {
wm_allied_respawntime 10
wm_axis_respawntime 10

setstate one invisible   (this has nothing to do with the chocolate)
setstate oc invisible
setstate laddertoi invisible

wait 350
wm_set_defending_team 0
setstate one invisible   (this has nothing to do with it)
wm_set_round_timelimit 50
globalaccum 0 set 0
globalaccum 1 set 0
globalaccum 2 set 0
globalaccum 3 set 0
   }
}

tmul
{
activate allies
{
printglobalaccum 0
globalaccum 0 set 1
}
activate axis
{
printglobalaccum 0
globalaccum 0 set 0
}
}

choco
{
death
{
trigger self allies
trigger self axis
wait 1000
trigger self check
}
trigger allies
{
globalaccum 0 abort_if_equal 0
globalaccum 1 inc 1
globalaccum 3 inc 1
printglobalaccum 1
printglobalaccum 3
}
trigger axis
{
globalaccum 0 abort_if_equal 1
globalaccum 2 inc 1
globalaccum 3 inc 1
printglobalaccum 2
printglobalaccum 3
}
trigger check
{

globalaccum 3 abort_if_not_equal 44
trigger self alwin
trigger self axwin
trigger self sudden
wait 1000

        ( i put the endround command in the triggers)
}
trigger alwin
{
globalaccum 1 abort_if_less_than 22
wm_setwinner 1
wm_endround
}
trigger axwin
{
globalaccum 2 abort_if_less_than 22
wm_setwinner 0
wm_endround
}
trigger sudden
{
globalaccum 1 abort_if_not_equal 22 
//geht auch mit accum 2!
setstate one default     (an extra piece spawns on a not reachable place.. =&gt; set states of constrtuctible              ladders default)
setstate oc default
setstate laddertoi default
//leitern baufähigmachen .. auf dach ist ein stück !
}
}

holemul    ( has nothing to do with chocolate)
{
activate
{
alertentity holeexpl
}
}



onemultiple    (this has nothing to do with it , too)
{
activate allies
{
globalaccum 0 set 1
}
activate axis
{
globalaccum 0 set 0
}
}
one    (the extra piece of chocolate if the allies and axis have the same numbers of chocolate)
{
death
{
setwinner 0 
trigger self all
wm_endround
}
trigger all
{
globalaccum 0 abort_if_not_equal 1
setwinner 1
}
}
[code/]

i dont want to use invisible user because.. if I SEE a piece of chocolate.... it suddenly "disappears" xD without -&gt; pressing a button

(isbowhten) #9

yeah! i worked it out.
i put the wait command at the end of the routine instead of the middle of it… strange… but that’s it

i can hurt entites… e.g. a script_mover… with trigger_hurt… so it does take much more time to “eat” the chocolate!
but i can shoot it, too i think… or can i make it unshootable AND damageable ?

if this doesnt work:
is this sensible? ->
func_explosive: script: pain:constructible health 999 // entity isnt shootable

in the script: the multiple: wait 1000 globalaccum 4 inc 1
                                                                       abort if &lt; 5
                                                                          setstate hut default (44 hurt entities)

now the hurt entity hurts the explosive with mor then 999 health.
so it took 5 sec to “eat” the chocolate
what do you think of this idea? or have you better ones?


(-SSF-Sage) #10

I’m afraid you can’t. Why don’t you just make it wait a little until it explodes and incs the globalaccum. Trigger_hurt is for a trigger that a player touches it damages the player.

Give the health key a value of 0. Damageable how?

func_explosive:key health value 0: script: pain:your triggers or whatever

I need to go now. Gonna be back later. Maybe more then. Btw it is a pain in the ass trying to understand what you say or want to have.


(isbowhten) #11

eh… sorry… i cant speak englsih well.
the problem is: if i put a wait… i just must eat the chocolate for one second and after few seconds it is gone-… but you MUST stay near it. the chocolate usually doesnt eat itself.
i tried something out… can i destroy a func_explosive with a target_kill?
this was my not working idea:
trigger multiple for axis and allies… (globalaccum 0 set 0 or 1 for the teams)
now in the script is a wait command… and an accum is increased… after the accum is 5 it is resetted to the value 0 and another trigger_multiple activateable by both teams is set to the state default.
this multiple targets the target_kill entity… and this one the func explosive…
the routine called “trigger ch” is executed… the multiples whcih “spawn” after the accum has the value 5 are set to default -> wait 400 -> set to invisible (because all 44 entites have the same targetname)
… i also tried only to activate the target_kill by a simple multiple which is set to state Default… but it didnt work.
g_scriptdebug also says: (n/a) : activate
this is the spawned multiple entity, it has no scriptname => (n/a) …
so the target_kill doesnt kill the func explosive.

script:


tmulaxis   (i post here only the axis version)
{
spawn
{
accum 0 set 0
setstate newmul invisible   ( the multiple which is set to default when accum 0 is 5)
}
activate
{


globalaccum 0 set 0    (this is if axis or allies activated their multiple... it is used in the death event in choco)
accum 0 inc 1   

trigger self ch

}
trigger ch
{
accum 0 abort_if_not_equal 5    (if it isn't 5 => if you didn't stay for about 5 seconds in the trigger_multiple)
accum 0 set 0                
setstate newmul default   (the multiple which targete the target_kill entity)
wait 400             (all 44 target_kills have this targetname...but only for 0.4 seconds those multiples are available)
                           (=> only one explosive should be destroyed because you cant walk to a second target_kill-multiple)
setstate newmul invisible
}

}


(-SSF-Sage) #12

You can always alertentity targetname which cause func_explosive to explode and call the death function altho you could just use script_mover instead. You don’t need the target_kill for the multiple. But if you use that way you have scripted, every multiple is under same scriptname. You can eat a little for example first chocolate move to another and eat it, but it does remember the time you used to eat the other, which will lead into -x amount of time if you didn’t finished another chocolate.

I got enough and tried a little. I run into something weird tho. Wait key doesn’t seem to work in trigger_multiple… AGAIN! This can be worked around, easy if you give all separate scriptnames. For my test I targeted the multiple into a target_speaker to play a random sound (could be used for a “eating” sound too :wink: ). Because it needs to be targeted somewhere. So here is what I did.

Func_exl. targetname and scriptname: choco (this way you will get the death event, althought you basicly wouldn’t need it anymore)
Target_speaker targetname dummy ; spawnflags 10
trigger_multiple target: dummy ; targetname and scriptname: multiple.

Script I used for testing:


multiple
{
	spawn
	{
	wait 100
	accum 0 set 0 //made a typo, had inc 1 instead of set 0 -_-
	}

	activate
	{

	accum 0 inc 1   

	trigger self ch

	}

	trigger ch
	{
	accum 0 abort_if_not_equal 5
	accum 0 set 0                
	alertentity choco
	setstate multiple invisible
	setstate dummy invisible
	}
}

But this will probably not be the way to go for you, because of what I said up there ^^. I would probably use different method anyway. I probably would have every chocolate (script_movers) be on it’s own set and trigger into the “rest of the stuff”. Basicly what I mean is I would have separate multiples, with separate scriptnames and separate script_movers which I just would setstate to be invisible when “aten”. All multiples could probably target into same target_speaker or whatever. I’m just too lazy to go for it atm.

Also if someone knows what is with the wait key in the trigger_multiple, could tell me about it.

Edit. I re read what I typed. This way you will need to have all separate anyway. Because that alertentity targetname is specified one and different for every func_explosive.


(-SSF-Sage) #13

Sry for double posting. But the last post got so confusing I thougth that I would start a fresh one. I don’t have all the stuff you want but I assume you know how to add them. We do it in a way that we assume the wait key in trigger_multiple and activate allies/axis doesn’t work. Lot’s ot extra work cos of that.

Ok so here we start:

script_mover targetname and scriptname: choco1 //didn’t set solid flag, cos it’s chocolate
Target_speaker targetname dummy1 ; spawnflags 2
trigger_multiple target: dummy1 ; targetname and scriptname: multiple1_allies allied_only
trigger_multiple target: dumm1y ; targetname and scriptname: multiple1_axis axis_only

script:


multiple1_allies
{
	spawn
	{
	wait 100
	//just to be sure:
	accum 0 set 0

	setstate choco1 default
	setstate multiple1_allies default
	setstate multiple1_axis default
	setstate dummy1 default
	}

	activate
	{
	accum 0 inc 1
	
	setstate dummy1 default 
	setstate multiple1_allies invisible //in these
	wait 1000					//3 lines
	setstate multiple1_allies default   //we assume that wait key doesn't work in trigger_multiple 
	setstate dummy1 invisible	
	
	accum 0 abort_if_not_equal 6 //we need 6 to wait 5 seconds
	
	setstate choco1 invisible  //if you want to use func_expl, alertentity instead
	setstate multiple1_allies invisible
	setstate multiple1_axis invisible			

	wm_announce "choco1 gone"

	//trigger your check stuff etc. here
	}
}

multiple1_axis
{
	spawn
	{
	wait 100
	//just to be sure:
	accum 0 set 0
	}

	activate
	{
	accum 0 inc 1
	
	setstate dummy1 default 
	setstate multiple1_axis invisible //in these
	wait 1000					//3 lines
	setstate multiple1_axis default   //we assume that wait key doesn't work in trigger_multiple 
	setstate dummy1 invisible	
	
	accum 0 abort_if_not_equal 6 //we need 6 to wait 5 seconds
	
	setstate choco1 invisible  //if you want to use func_expl, alertentity instead
	setstate multiple1_allies invisible
	setstate multiple1_axis invisible			

	wm_announce "choco1 gone"

	//trigger your check stuff etc. here
	}
}

Here is something like I meant. It works, but it is extra work, cos of the 2 non working things ^^. To turn into next set of chocolate and stuff, just change the names from 1 to 2 etc. and do the same in script.

edit. TIP: you can/should put the counter and game check triggers into game_manager and trigger the right ones from each multiples.

I wish I didn’t confuse you totally.


(isbowhten) #14

well i know i could seperate it in different sdcript and targetnames but i’m too lazy. isnt there any other way??
i tried following:
after accum = 5 another multiple spawns and it really SPAWNS… but it doesnt seem to work…
sriptdebug says it is set to default but it doesnt kill the expl… (with alertentity)


(-SSF-Sage) #15

Alertentity explodes the func_explosive (once, after it it doesn’t find it anymore and makes an error msg.) Usage: alertentity targetname.

Edit. Wait: setstate choco1 default, is for script_mover. alertentity choco1 to explode the func_explosive. I tested the crap on both msg I made with the script attached and it worked.


(isbowhten) #16

so . I’m at my cousins PC… i will post my map if i have internet at home again.
there are 2 mistakes…
there are 4*11 pieces of chocolate… the rows with the 11 pieces of chocolate in the middle can be destroyed… the rows on the sides cant be destroyed although they are built the same way …
AND after building a bridge ET closes itself.
well… i have no internet til end of this month and perhaps longer… plz don’t forget me xD