PDA

View Full Version : Area time stop?


Malxados
03-21-2009, 05:42 PM
I have two questions:
1) What exactly is the time stop effect ("effect EffectTimeStop();") and will it work for TSL?

2)How would I apply said effect or another (such as paralysis) to every enemy in/ the entire area?

Thanks
Malxados

EDIT: BTW, I was hoping to use this as a force power script.

glovemaster
03-22-2009, 09:37 AM
The EffectStopStop() simply stops everything, does what it says really. Its kinda like a pause without being paused - So I'd imagine it probably is what the game fires when you hit pause.

The effect is pretty useless as the PC can't move either. Would have been pretty cool otherwise though :p

Malxados
03-22-2009, 10:23 AM
What would the script look like to paralyze everyone in the area (for a spell)?

glovemaster
03-22-2009, 10:53 AM
The script to paralyse all hostiles in the current area would looks like this:
void main() {
// Duration of paralysis
fDuration = 10.0; // Just change this to how long you want to paralyze enemies for.

// Paralyse all hostiles in the area.
object oTarget = GetFirstObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
while(GetIsObjectValid(oTarget)) {
if(GetIsEnemy(oTarget)) {
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, oTarget, EffectParalyze(), fDuration);

oTarget = GetNextObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
}
}
}

Just change the 10.0 to how ever long it needs to be for.

stoffe
03-22-2009, 11:13 AM
The script to paralyse all hostiles in the current area would looks like this:
void main() {
// Duration of paralysis
fDuration = 10.0; // Just change this to how long you want to paralyze enemies for.

// Paralyse all hostiles in the area.
object oTarget = GetFirstObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
while(GetIsObjectValid(oTarget)) {
if(GetIsEnemy(oTarget)) {
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, oTarget, EffectParalyze(), fDuration);

oTarget = GetNextObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
}
}
}

Just change the 10.0 to how ever long it needs to be for.

Move the GetNextObjectInArea() line outside the conditional check or the loop would get stuck as soon as it encounters any NPC who isn't hostile to the one running the script. :)

Also you have the Target and Effect parameters in the wrong order in the ApplyEffectToObject() call.

glovemaster
03-22-2009, 11:23 AM
Whooops :dozey: thanks Stoffe :lol:

This one should work :roleyess:
void main() {
// Duration of paralysis
fDuration = 10.0; // Just change this to how long you want to paralyze enemies for.

// Paralyse all hostiles in the area.
object oTarget = GetFirstObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
while(GetIsObjectValid(oTarget)) {
if(GetIsEnemy(oTarget)) {
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectParalyze(), oTarget, fDuration);
}
oTarget = GetNextObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
}
}

Malxados
03-22-2009, 02:57 PM
Thanks.
I'll hopefully be able to try it out soon.

EDIT: Also, what would I put for the duration to make it permanent?

EDIT2: It gives me the error "Undeclared identifier "fDuration"" for lines 3 and 9, even if I don't change anything.

GeorgNihilus
03-22-2009, 04:02 PM
EDIT: Also, what would I put for the duration to make it permanent?

I don't know, just put a bigggggg number ...


EDIT2: It gives me the error "Undeclared identifier "fDuration"" for lines 3 and 9, even if I don't change anything.

You need to declare fDuration before giving it a number, try this one, it compiled clean for me but I haven't tested it :xp: ...

void main() {

float fDuration;
// Duration of paralysis
fDuration = 1000.0 // Just change this to how long you want to paralyze enemies for.

// Paralyse all hostiles in the area.
object oTarget = GetFirstObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
while(GetIsObjectValid(oTarget)) {
if(GetIsEnemy(oTarget)) {
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectParalyze(), oTarget, fDuration);
}
oTarget = GetNextObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
}
}

hope it helps ;)

Malxados
03-22-2009, 04:21 PM
Really? It gave me an error at line 8: "syntax error at "object"". If it helps, this should be for TSL.

stoffe
03-22-2009, 04:23 PM
Thanks.
I'll hopefully be able to try it out soon.

EDIT: Also, what would I put for the duration to make it permanent?

EDIT2: It gives me the error "Undeclared identifier "fDuration"" for lines 3 and 9, even if I don't change anything.

Change DURATION_TYPE_TEMPORARY to DURATION_TYPE_PERMANENT when applying the effect.

As for fDuration it hasn't been declared yet when a value is assigned to it, which must be done for the compiler to know what data type it's supposed to be. But if the effect is supposed to be permanent it has no purpose and can be removed.


void main() {
effect eParalyze = EffectParalyze();
object oTarget = GetFirstObjectInArea();

while (GetIsObjectValid(oTarget)) {
if (GetIsEnemy(oTarget)) {
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eParalyze, oTarget);
}

oTarget = GetNextObjectInArea();
}
}

Malxados
03-22-2009, 04:30 PM
Thanks, yours compiled fine. However, I was hoping to make one with a permanent duration and one or more with a temporary duration (which I've been unsuccessful at).

Anyone?

Star Admiral
03-22-2009, 06:35 PM
Same as what stoffe posted, except change DURATION_TYPE_PERMANENT to DURATION_TYPE_TEMPORARY and add a time such as 30.00.

void main() {
effect eParalyze = EffectParalyze();
object oTarget = GetFirstObjectInArea();

while (GetIsObjectValid(oTarget)) {
if (GetIsEnemy(oTarget)) {
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eParalyze, oTarget, 30.00);
}

oTarget = GetNextObjectInArea();
}
}

- Star Admiral

Malxados
03-22-2009, 08:52 PM
Yay! All three (powers) worked! Thanks guys. Its really funny walking right past tons of enemies. I think I even froze one in mid-air. Hopefullly after I finish some technicalities I can upload it.