Lua Scripts/Questions/Help
89 replies I was wandering if its possible (no sprite) to make a invisible block coz it cold be very cool to make invisible stairs and stuff but it cold be still be "detected" by blood spatter or explosion craters ...
By the way whats the status on the fire extinguisher ?!?
By the way whats the status on the fire extinguisher ?!?
My Eng. Suks so don't comment on my Gram. misstakes !!!
RULZ!

mumu:
invisible objects: yes, that's possible. you have to use Lua scripted objects for that (see shield generator or explosives script). just don't do anything in the object draw function!
BUT: blood splatter, craters and other effects can not be rendered to invisible objects. that's technically not possible in carnage contest. they can only be rendered to terrain and terrain is always non-transparent.
loooser:
indirectly. you can use
getframe in combination with the modulo operator so your action is executed every 50 frames (50 frames = second). use this in your update function:
(untested)
invisible objects: yes, that's possible. you have to use Lua scripted objects for that (see shield generator or explosives script). just don't do anything in the object draw function!
BUT: blood splatter, craters and other effects can not be rendered to invisible objects. that's technically not possible in carnage contest. they can only be rendered to terrain and terrain is always non-transparent.
loooser:
indirectly. you can use

Code:
1
2
3
2
3
if (getframe()%50)==0 then
-- your actions here
end
-- your actions here
end
(untested)
Thank you, for the information
But does that also work for gamemodes?
by they way:
is there also a hook for end turn or better start turn?
how to make terrain indestructible?
But does that also work for gamemodes?
by they way:
is there also a hook for end turn or better start turn?
how to make terrain indestructible?

loooser has written:
Thank you, for the information
But does that also work for gamemodes?
by they way:
is there also a hook for end turn or better start turn?
how to make terrain indestructible?
But does that also work for gamemodes?
by they way:
is there also a hook for end turn or better start turn?
how to make terrain indestructible?
It does, all lua commands work in GAmeModes, so you can poosible make flying greands


EDIT: DC has implemented somehting, not sure thogh. I might be dreaming.
21.11.10 12:45:28 pm
hi all, i made a weapon with script, everything fine, loaded and image in hand and weapon select menu is ok. But what i dont understand is shooting. if you press space for shoot so you have chance 1:6 in one round it will start shooting into youreself (like if you just delete : no collision with current player on start). i dont know what it is. please can anyone help?
Here:
That should do the trick when placed intside the firing action.
Code:
1
projectiles[id].ignore=playercurrent()
That should do the trick when placed intside the firing action.

You changed speed of projectile but you didn't change initial movement, so, it moves directly through player more than 1 time.
@DanyDeth - i had that, i controlled it 2 times, that sentence was in script, but thanks for answer :).
@Vectar666 - thank you, it was by speed that i made ^^.
@Vectar666 - thank you, it was by speed that i made ^^.
Yes there is.
Chack playery and watery, if they are close, push player by absolute, push x=getplayerxspeed(i), push y=-getplayeryspeed(i)
where i is for loop variable.
Chack playery and watery, if they are close, push player by absolute, push x=getplayerxspeed(i), push y=-getplayeryspeed(i)
where i is for loop variable.
Thanks.
damn there is no button to delete posts. Some idea came in my mind after like 1-2 min's after i post it. But i didnt thought about "push x=getplayerxspeed(i)"
damn there is no button to delete posts. Some idea came in my mind after like 1-2 min's after i post it. But i didnt thought about "push x=getplayerxspeed(i)"
i have a problem
how do i find out what type an object has (the object is not in the same script) that is not an default object and has been created by an other script?
because i want to make that a weapon only attacks one special object ,and the only way to find this object is with the type
here is an example
also some questions are:
Is the type a number or what else?
in the cc page you can find this info for objecttable()
what do i have to write objecttable(here) if i only what objects with this type?
ps i hope you understand what i meant
how do i find out what type an object has (the object is not in the same script) that is not an default object and has been created by an other script?
because i want to make that a weapon only attacks one special object ,and the only way to find this object is with the type
here is an example
Code:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
--Here i try to find an object with this type but i dont know what i have to write as type
allobjects=objecttable()
for i=1,#allobjects do
if getobjecttype(allobjects[i])==cc.heli.object.id then -- now what do i write instead of cc.heli.object.id
--or where do i find the type
--do something
end
end
allobjects=objecttable()
for i=1,#allobjects do
if getobjecttype(allobjects[i])==cc.heli.object.id then -- now what do i write instead of cc.heli.object.id
--or where do i find the type
--do something
end
end
also some questions are:
Is the type a number or what else?
in the cc page you can find this info for objecttable()
Code:
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
objecttable([TYPE=0])
Parameters:
[TYPE=0] - list objects of this type only (0 for all types)
Returns:
OBJECT TABLE - a table containing object IDs
Returns a table/array which contains the IDs of objects in the game.
By default all object types are included. Use another value for TYPE to get a table which only contains objects of a certain type.
Parameters:
[TYPE=0] - list objects of this type only (0 for all types)
Returns:
OBJECT TABLE - a table containing object IDs
Returns a table/array which contains the IDs of objects in the game.
By default all object types are included. Use another value for TYPE to get a table which only contains objects of a certain type.
what do i have to write objecttable(here) if i only what objects with this type?
ps i hope you understand what i meant
edited 7×, last 23.08.11 02:33:03 pm


simply use this variable for

does that mean what i am trying is impossible?
also is there a way to use varialbes from a other weapon script?
also is there a way to use varialbes from a other weapon script?

you didn't get me, right? of course it's possible and of course you can access variables of other weapon scripts. that's what I was talking about
but be careful: you shouldn't try to access variables from other weapons directly when the script is loaded (outside a CC function). this might lead to problems.
and you should also check if the used table is ~= nil because otherwise your script will cause a bug when the other weapon/object is currently not in the weaponset.

but be careful: you shouldn't try to access variables from other weapons directly when the script is loaded (outside a CC function). this might lead to problems.
and you should also check if the used table is ~= nil because otherwise your script will cause a bug when the other weapon/object is currently not in the weaponset.
edited 1×, last 23.08.11 04:40:58 pm
it's actually like writing ALL your weapon scripts into one single Lua file and executing this file. you can access all variables of all weapons.