Page 1 of 2
Im really going crazy...
Posted: Thu Jan 19, 2006 4:04 pm
by simsalabim
i hope ill find some help here... (im a n00b btw)
Game:
MOHAA
What i want:
If a player reaches a certain height, i.e. 1st floor, his health slowely decreases until he reaches the ground again.
>> if player is above (0 0 100) -> slowely decrease health
>> if he is beneath (0 0 100) -> stop decreasing
What i tried (ideas i got from here:)
trigger - i tried the trigger first (no success at all btw), then i saw somewher on this board, that if 1 player is allrdy "triggering", it wouldnt effect on a 2nd one -> discarded
Fire - i think if i put an area this big under fire, i would get major lags - or am i wrong?
Any other solutions? Is it possible to query the height-position?
thx in advance,
simsala
Posted: Fri Jan 20, 2006 2:27 am
by simsalabim
24 views and noone has an idea? i mean, is it really THAT hard?
dont get me wrong, im just wondering - no offense at all
Posted: Fri Jan 20, 2006 8:06 am
by jv_map
Welcome to .Map simsalabim

... it sometimes takes a while but the good news is that hardly any problem goes unsolved here
I think the main reason why you didn't get a reply yet is because you didn't post any code you tried, but are basically asking others to make the script for you. People here often like you to try things, and then will help out when you run into problems.
Now on to the actual problem, something like this will work.
Code: Select all
main:
// the usual
// launch 'painful_up_there' as a seperate process
// so it doesn't interfere with rest of script
thread painful_up_there
end // ! this 'end' is often forgotten !
painful_up_there:
// loop forever
while(1)
{
// 'browse' through all players
// and subtract health if they are too high
for(local.i = 1; local.i <= $player.size; local.i++)
{
local.p = $player[local.i]
// check if player is alive, and not spectating
// there is a slight 'hole' here, as players that have
// joined a team but not yet selected a weapon
// are technically alive and not a 'spectator'
// but have not spawned yet and are still
// spectating the map.
// this is mostly a bug / inconvenience in mohaa
// that is not impossible but hard to get around
// I'm not sure if spectating players can be hurt
// if they can, then this is a potential problem
if(isAlive local.p && local.p.dmteam != "spectator")
{
// z-coordinate check
// 100.0 would be the actual radiant z-coord
if(local.p.origin[2] >= 100.0)
{
// hurt a bit
local.p hurt 0.05 // 1 hp per secod
}
}
}
// wait 1 frame (50 msec) before going through the loop again
waitframe
}
end
Posted: Sat Jan 21, 2006 3:16 am
by simsalabim
First of all - thank you very much! I'll try this one out asap.
The reason why i didn't post any code is that none of them worked AND the code i made was absolutely useless, since a trigger can only be activated by one player at a time.
So i really didnt know where to start. But believe me - i actually spent a lot of time on that problem

I mean, you can see from the topic how desperate i really was...
Anyhow - ill try this one out and tell you if it works.
Thx,
simsalabim
Posted: Sat Jan 21, 2006 3:37 am
by simsalabim
IT WORX - I LUV YOU!
What i would like to add:
1. A delay of aprox. 5 secounds before it starts to kill. (I'll try that on my own first

)
2. A warning message for the Player alone "Get to Groundzero - You have 5 secounds!" - is that possible? i mean a message that only the player will see?
T i a,
simsalabim
Posted: Sat Jan 21, 2006 8:22 am
by jv_map
A warning message for 1 player only can be done like this:
local.p iprint "Get to Groundzero - You have 5 secounds!" 1
The '1' makes this a white, clicking message. If you put a 0, you'll get a silent yellow message.
Posted: Sat Jan 21, 2006 6:01 pm
by simsalabim
Problem:
Code: Select all
//initialising sound
local.master = spawn ScriptMaster
local.master aliascache fin_count sound/items/final_countdown.wav soundparms 0.7 0.0 1.0 0.0 10000 10000 local loaded maps "dm moh obj"
Want to play it here:
for(local.timer=0; local.timer<10; local.timer++)
{
if(local.p.origin[2] >= 20.0)
{
wait 1
local.p hurt 5.0 playsound fin_count // 1 hp per secound + play sound
if(local.timer < 1)
{
local.p iprint "I'm so n00bish u won't believe! :)" 1
local.p iprint "Whatever!" 1
}
}
}
Any suggestions??
Thx in Advance,
simsalabim
Posted: Sun Jan 22, 2006 3:06 am
by LeBabouin
simsalabim wrote:Problem:
Code: Select all
//initialising sound
local.master = spawn ScriptMaster
local.master aliascache fin_count sound/items/final_countdown.wav soundparms 0.7 0.0 1.0 0.0 10000 10000 local loaded maps "dm moh obj"
Want to play it here:
for(local.timer=0; local.timer<10; local.timer++)
{
if(local.p.origin[2] >= 20.0)
{
wait 1
local.p hurt 5.0 playsound fin_count // 1 hp per secound + play sound
if(local.timer < 1)
{
local.p iprint "I'm so n00bish u won't believe! :)" 1
local.p iprint "Whatever!" 1
}
}
}
Any suggestions??
Thx in Advance,
simsalabim
maybe:
Code: Select all
for(local.timer=0; local.timer<10; local.timer++)
{
if(local.p.origin[2] >= 20.0)
{
wait 1
local.p hurt 5.0 playsound fin_count // 1 hp per secound + play sound
if(local.timer =4)
{
local.p iprint "Get to Groundzero - You have 5 secounds!" 1 }
if(local.timer < 1)
{
local.p iprint "I'm so n00bish u won't believe! :)" 1
local.p iprint "Whatever!" 1
}
}
}
Posted: Sun Jan 22, 2006 3:31 am
by GiffE1118
cant have spaces in ur thread name
Posted: Sun Jan 22, 2006 4:07 am
by simsalabim
Oh, lol, missunderstanding.
Want to play it here: isnt a thread...
What i meant was, that i cant get the sound to work.
Its not playing.
I used the ubersound-bypass by jv_map to work arround those tiki files, cuz i have no idea what they really are...
So there must be a syntax-error or something, when i try to play the sound in:
Code: Select all
local.p hurt 5.0 playsound fin_count
Sorry

Posted: Sun Jan 22, 2006 4:11 am
by simsalabim
Okay nevermind...
Sorted it out.
Code: Select all
local.p hurt 5.0
local.p playsound fin_count
Did it!
Posted: Sun Jan 22, 2006 4:29 am
by simsalabim
Another question: (< no thread

)
The particular player has been given this variable: local.p
How can i put his name in...
iprintln "$player?" <this doesnt work
Thx again,
simsalabim
Posted: Sun Jan 22, 2006 8:58 am
by jv_map
local.p = $player[local.i]
So you could replace local.p with $player[local.i].
$player[local.i] iprint "I'm so n00bish u won't believe!

" 1
Posted: Sun Jan 22, 2006 3:18 pm
by simsalabim
/me slams head on desk...
Thank you...
Posted: Sun Jan 22, 2006 4:03 pm
by jv_map
Awww poor desk
You're welcome, good luck with the script
