Scripting related question
Moderator: Moderators
-
Astute
- Rebel Colonel

- Posts: 566
- Joined: Tue Apr 12, 2005 7:03 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Scripting related question
I've been trying out new functions/callbacks in lua and i've run into some problems. Callbacks such as OnFinishCaptureName do not work, but ones such as OnObjectKillName do. Were the ones that don't work just never added? or is there some kind of syntax i'm missing.
Here is a sample.
OnFinishCaptureName(airlockfill, "airlock1");
Any scripting wizards have a remedy?
Here is a sample.
OnFinishCaptureName(airlockfill, "airlock1");
Any scripting wizards have a remedy?
-
xwingguy
RE: Scripting related question
If airlock1 ain't the name of the cp nothing will work.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
RE: Scripting related question
All the callbacks work, you just have to get the syntax and data types correct.
-
Astute
- Rebel Colonel

- Posts: 566
- Joined: Tue Apr 12, 2005 7:03 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Scripting related question
Hmm, then it's just very hard to get them to work then. What happens ingame is i capture the cp named "airlock1", but for some reason airlockfill never triggers.
-
xwingguy
RE: Scripting related question
post the function airlockfill()
-
Astute
- Rebel Colonel

- Posts: 566
- Joined: Tue Apr 12, 2005 7:03 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Scripting related question
function airlockfill()
PlayAnimation("rise1");
end
Well, thats it. I know it works because i've tested it on a working callback(onobjectkillname)
PlayAnimation("rise1");
end
Well, thats it. I know it works because i've tested it on a working callback(onobjectkillname)
-
Astute
- Rebel Colonel

- Posts: 566
- Joined: Tue Apr 12, 2005 7:03 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Scripting related question
Ok, i was able to get my function working, however now i'm having trouble with timers.
Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call global `OnTimerElapseName' (a nil value)
stack traceback:
(none): in function `ScriptPostLoad'
The scripting for the timer
Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call global `OnTimerElapseName' (a nil value)
stack traceback:
(none): in function `ScriptPostLoad'
The scripting for the timer
Very confusing.. but am I defining the timer right?conquest:Start()
airlock1_timer = CreateTimer("airlock1_timer");
SetTimerValue(airlock1_timer, 5.0);
StartTimer(airlock1_timer);
OnTimerElapseName(airlockfill, "airlock1_timer");
end
function airlockfill()
PlayAnimation("rise1");
SetTimerValue(airlock1_secondary, 5.0);
StartTimer(airlock1_secondary);
end
-
xwingguy
RE: Scripting related question
OnTimerElapseName() doesn't exist
it's just
OnTimerElapse()
it's just
OnTimerElapse()
-
Astute
- Rebel Colonel

- Posts: 566
- Joined: Tue Apr 12, 2005 7:03 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Scripting related question
How is the timer formated then? I don't really see any good examples in the official luas.
-
xwingguy
RE: Scripting related question
OnTimerElapseName(airlockfill, "airlock1_timer");
should be
OnTimerElapse(airlockfill, airlock1_timer);
You should read the campaign scripts, they contain a lot of useful info.
should be
OnTimerElapse(airlockfill, airlock1_timer);
You should read the campaign scripts, they contain a lot of useful info.
-
Astute
- Rebel Colonel

- Posts: 566
- Joined: Tue Apr 12, 2005 7:03 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Scripting related question
Yeah, i've read through quite a few of the campaign scripts, but usually they are formated like this.
OnTimerElapse(
function(timer)
StartObjectives()
ScriptCB_EnableCommandPostVO(0)
ScriptCB_SndPlaySound("MYG_obj_01")
ScriptCB_SndPlaySound("MYG_obj_02")
DestroyTimer(timer)
end,
timePop
)
I tried implementing it this way, but all it would do is crash my game. I don't think i've ever seen it formated like the one you suggested anywhere in the campaign files.
OnTimerElapse(
function(timer)
StartObjectives()
ScriptCB_EnableCommandPostVO(0)
ScriptCB_SndPlaySound("MYG_obj_01")
ScriptCB_SndPlaySound("MYG_obj_02")
DestroyTimer(timer)
end,
timePop
)
I tried implementing it this way, but all it would do is crash my game. I don't think i've ever seen it formated like the one you suggested anywhere in the campaign files.
-
xwingguy
RE: Scripting related question
just do it the way I posted it.
-
Astute
- Rebel Colonel

- Posts: 566
- Joined: Tue Apr 12, 2005 7:03 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Scripting related question
lol, yeah. Btw, thx, it worked. Now I can finally get back to modding instead of grappling with annoying errors.
